ggmice icon indicating copy to clipboard operation
ggmice copied to clipboard

The `plot_pattern()` function produces a non-informative error when complete data is supplied

Open hanneoberman opened this issue 2 years ago • 0 comments

Problem:

ggmice::plot_pattern(na.omit(mice::boys))
#>  /\     /\
#> {  `---'  }
#> {  O   O  }
#> ==>  V <==  No need for mice. This data set is completely observed.
#>  \  \|/  /
#>   `-----'
#> Error in `stop_subscript()`:
#> ! Can't subset columns that don't exist.
#> x Columns `age`, `hgt`, `wgt`, `bmi`, `hc`, etc. don't exist.

Created on 2022-04-05 by the reprex package (v2.0.1)

Solution: add a return() in the preprocessing part of the function to exit the function immediately whenever the data is complete

hanneoberman avatar Apr 05 '22 14:04 hanneoberman