Skip to content

A couple of bugs with missing_plot #72

@nathansam

Description

@nathansam

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

else {
 vlabels = NULL
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions