ggmice
ggmice copied to clipboard
Make jitter work with incomplete categorical variables
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)
Maybe check if jitter can be applied either horizontally or vertically, depending on the missingness? E.g. geom_jitter(width = 0)
Alternative: VIM::marginplot()
-like functionality
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