Hi there,
I just thought I would flag a few bugs I have come across whilst using the missing_plot function. The vlabels variable is created here in a conditional statement and is used later when creating the ggplot object. Therefore if the function is called with use_labels = FALSE, the function will error.
|
# Labels |
|
if(use_labels){ |
|
vlabels = extract_labels(df.in)$vfill |
|
} |
Having
fixes the problem. Secondly, the code here:
|
df.in$.id = rownames(df.in) %>% as.numeric() |
only works if the row names are the row numbers. If you use the function in a context where the row names aren't the row numbers (such as after subsetting the data frame), then the plot is bugged (as shown in the screenshot below).
Replacing the above line with the below line should stop this behaviour.
df.in$.id = seq(1, nrow(df))
I would be happy to open a PR, if you would like the bugs fixed, but it might just be easier for you to make the changes yourselves.
Kind regards
Hi there,
I just thought I would flag a few bugs I have come across whilst using the
missing_plotfunction. Thevlabelsvariable is created here in a conditional statement and is used later when creating the ggplot object. Therefore if the function is called withuse_labels = FALSE, the function will error.finalfit/R/missing_plot.R
Lines 39 to 42 in b1fa0f0
Having
fixes the problem. Secondly, the code here:
finalfit/R/missing_plot.R
Line 51 in b1fa0f0
only works if the row names are the row numbers. If you use the function in a context where the row names aren't the row numbers (such as after subsetting the data frame), then the plot is bugged (as shown in the screenshot below).
Replacing the above line with the below line should stop this behaviour.
I would be happy to open a PR, if you would like the bugs fixed, but it might just be easier for you to make the changes yourselves.
Kind regards