Skip to content

Instantly share code, notes, and snippets.

@NErler
NErler / propplot.R
Last active May 1, 2024 00:36
Function to create barplot comparing observed and imputed values from a mids object.
# Compare proportions in categorical variables between observed and imputed data
# visually (using ggplot)
#
# Parameters:
# x: mids object (from mice)
# formula: formula describing which variables to plot
# facet: either "wrap" for facet_wrap or "grid" for facet_grid
# ...: additional parameters passed to theme()
#
# Note: if the formula is not specified, all imputed categorical variables are