Obtain a plot of the pattern of missing data and/or return the pattern as a matrix.
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 default position of legends ("none", "left", "right", "bottom", "top", "inside")
- sort_columns
logical; should the columns be sorted by number of missing values? (default is
TRUE)- ...
optional additional parameters, currently not used
Value
With plot = TRUE and pattern = FALSE (default) a
ggplot object. With pattern = TRUE and
plot = FALSE a matrix with one row per missing data pattern
(1: observed, 0: missing), the column Npat
(number of observations with this pattern), and the last row
Nmis (number of missing values per variable, and in total).
With both set to TRUE a list with elements plot and
pattern; with both FALSE, NULL.
Note
This function requires the ggplot2 package to be installed.
See also
See the vignette Visualizing Incomplete Data for more examples.

