Learn R Programming

ggmice (version 0.1.1)

plot_miss: Plot missingness in a dataset

Description

[Experimental]

Usage

plot_miss(
  data,
  vrb = "all",
  ordered = FALSE,
  rotate = FALSE,
  grid = FALSE,
  square = FALSE
)

Value

An object of class ggplot2::ggplot.

Arguments

data

An incomplete dataset of class data.frame or matrix.

vrb

String, vector, or unquoted expression with variable name(s), default is "all".

ordered

Logical indicating whether rows should be ordered according to their pattern.

rotate

Logical indicating whether the variable name labels should be rotated 90 degrees.

grid

Logical indicating whether borders should be present between tiles.

square

Logical indicating whether the plot tiles should be squares, defaults to squares.

Examples

Run this code
# plot correlations for all columns
plot_miss(mice::nhanes)

# plot correlations for specific columns by supplying a character vector
plot_miss(mice::nhanes, c("chl", "hyp"))

# plot correlations for specific columns by supplying unquoted variable names
plot_miss(mice::nhanes, c(chl, hyp))

# plot correlations for specific columns by passing an object with variable names
# from the environment, unquoted with `!!`
my_variables <- c("chl", "hyp")
plot_miss(mice::nhanes, !!my_variables)
# object with variable names must be unquoted with `!!`
try(plot_miss(mice::nhanes, my_variables))

# plot larger dataset
plot_miss(mice::boys)
plot_miss(mice::boys, ordered = TRUE)

Run the code above in your browser using DataLab