Learn R Programming

ggplot2 (version 0.9.0)

ggmissing: Create a plot to illustrate patterns of missing values.

Description

The missing values plot is a useful tool to get a rapid overview of the number and pattern of missing values in a dataset. Its strength is much more apparent when used with interactive graphics, as you can see in Mondrian (http://rosuda.org/mondrian) where this plot was copied from.

Usage

ggmissing(data, avoid = "stack", order = TRUE,
    missing.only = TRUE)

Arguments

data
input data.frame
avoid
whether missings should be stacked or dodged, see geom_bar for more details
order
if TRUE, order variables by number of missings
missing.only
if TRUE, only display variables with some missing data

See Also

ggstructure, ggorder

Examples

Run this code
mmissing <- movies
mmissing[sample(nrow(movies), 1000), sample(ncol(movies), 5)] <- NA
ggmissing(mmissing)
ggmissing(mmissing, order=FALSE, missing.only = FALSE)
ggmissing(mmissing, avoid="dodge") + scale_y_sqrt()

Run the code above in your browser using DataLab