ggmice icon indicating copy to clipboard operation
ggmice copied to clipboard

Make jitter work with incomplete categorical variables

Open hanneoberman opened this issue 2 years ago • 1 comments

hanneoberman avatar Mar 10 '22 09:03 hanneoberman

The problem is as follows: The missing data points are not plotted on top of the axes when jitter is used.

library(ggmice)
library(ggplot2)
ggmice(mice::nhanes, aes(age, bmi)) + geom_point()

ggmice(mice::nhanes, aes(age, bmi)) + geom_jitter()
#> Warning: Removed 9 rows containing missing values (geom_point).

Created on 2022-03-17 by the reprex package (v2.0.1)

hanneoberman avatar Mar 17 '22 19:03 hanneoberman

Maybe check if jitter can be applied either horizontally or vertically, depending on the missingness? E.g. geom_jitter(width = 0)

hanneoberman avatar Feb 02 '23 09:02 hanneoberman

Alternative: VIM::marginplot()-like functionality

hanneoberman avatar Feb 09 '23 13:02 hanneoberman

The current version does not have this issue

library(ggmice)
library(ggplot2)
ggmice(mice::nhanes, aes(age, bmi)) + geom_jitter()

Created on 2023-06-27 with reprex v2.0.2

hanneoberman avatar Jun 27 '23 14:06 hanneoberman