ggmice icon indicating copy to clipboard operation
ggmice copied to clipboard

Incomplete data are not displayed with `ggmice()` if log transformation is applied within the mapping

Open hanneoberman opened this issue 2 years ago • 1 comments

One solution is to apply the transformation beforehand. Maybe just add a message whenever a log transformation is applied on an incomplete variable within the aes() function? Or actually solve the issue?

hanneoberman avatar Mar 18 '22 14:03 hanneoberman

There are some solutions: using the I() function, transforming the data, or using one of the scale_*() functions.

hanneoberman avatar Jun 01 '22 12:06 hanneoberman

There 2 options:

  • data -> transform with mutate -> ggmice
  • data -> ggmice -> scale_*_log

hanneoberman avatar Jan 19 '23 13:01 hanneoberman

library(ggmice)
ggmice(mice::nhanes, ggplot2::aes(x = age, y = log(bmi))) + ggplot2::geom_point()
#> Warning in log(bmi): NaNs produced

#> Warning in log(bmi): NaNs produced
#> Warning: Removed 9 rows containing missing values (`geom_point()`).

Created on 2023-01-19 with reprex v2.0.2

hanneoberman avatar Jan 19 '23 13:01 hanneoberman

@pepijnvink please write a message if log( is included in one of the mapping variables

hanneoberman avatar Jan 19 '23 13:01 hanneoberman

Fixed in #80

hanneoberman avatar Jun 27 '23 11:06 hanneoberman