Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

md_pattern

Missing data pattern


Description

Obtain a plot of the pattern of missing data and/or return the pattern as a matrix.

Usage

md_pattern(data, color = c(grDevices::grey(0.1), grDevices::grey(0.7)),
  border = grDevices::grey(0.5), plot = TRUE, pattern = FALSE,
  print_xaxis = TRUE, ylab = "Number of observations per pattern",
  print_yaxis = TRUE, legend.position = "bottom", ...)

Arguments

data

data frame

color

vector of length two, that specifies the colour used to indicate observed and missing values (in that order)

border

colour of the grid

plot

logical; should the missing data pattern be plotted? (default is TRUE)

pattern

logical; should the missing data pattern be returned as matrix? (default is FALSE)

print_xaxis, print_yaxis

logical; should the x-axis (below the plot) and y-axis (on the right) be printed?

ylab

y-axis label

legend.position

the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector)

...

optional additional parameters, currently not used

Note

This function requires the ggplot2 package to be installed.

See Also

See the vignette Visualizing Incomplete Data for more examples.

Examples

op <- par(mar = c(3, 1, 1.5, 1.5), mgp = c(2, 0.6, 0))
md_pattern(wideDF)
par(op)

JointAI

Joint Analysis and Imputation of Incomplete Data

v1.0.2
GPL (>= 2)
Authors
Nicole S. Erler [aut, cre] (<https://orcid.org/0000-0002-9370-6832>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.