cranvas (version 0.8.5)

qmval: Draw a missing value plot

Description

A missing value plot shows the counts or proportions of missing values in each variable. It is essentially a stacked bar plot, i.e. a bar plot of variables split by the logical vectors of missingness of observations.

Usage

qmval(vars, data, horizontal = TRUE, standardize = TRUE, ...)

Arguments

vars
variables to show in the plot: a character vector of variable names, or a numeric vector of column indices, or a two-sided formula like ~ x1 + x2 + x3 (without the left-hand side); see var_names
...
arguments passed to qbar
data
a mutaframe created by qdata
horizontal
TRUE to draw a horizontal plot or FALSE (vertical)
standardize
logical: whether to standardize the height of each bar to 1

Value

A missing value plot

Details

As usual, common interactions are defined in common_key_press. Brushing on a missing value plot has a slightly different meaning with brushing other types of plots: if a rectangle is brushed in a missing value plot, all rows in the orginal data in which the current variable is brushed (i.e. either missing or non-missing) are brushed; on the other hand, the brushed rows in the original data will also be reflected in the missing value plot.

This plot is built upon the bar plot qbar.

See Also

Other plots: qbar; qboxplot; qdensity; qhist, qspine; qparallel; qtime

Examples

Run this code
library(cranvas)

## BRFSS data
qbrfss <- qdata(brfss)
qmval(names(brfss)[40:50], data = qbrfss)
qmval(51:68, data = qbrfss)
qmval(~poorhlth + fruit + greensal, data = qbrfss)

qparallel(100:110, data = qbrfss)

## TAO data
data(tao, package = "tourr")

qtao <- qdata(tao)
qmval(~., data = qtao)
qmval(~., data = qtao, horizontal = FALSE, standardize = FALSE, 
    main = "horizontal plot with counts")
qscatter(longitude, latitude, data = qtao)

cranvas_off()

Run the code above in your browser using DataLab