Learn R Programming

visdat (version 0.0.4.9999)

vis_miss: Visualise a data.frame to display missingness.

Description

vis_miss provides an at-a-glance ggplot of the missingness inside a dataframe, colouring cells according to missingness, where black indicates a missing cell and grey indicates a present cell. As it returns a ggplot object, it is very easy to customize and change labels, and so on.

Usage

vis_miss(x, cluster = FALSE, sort_miss = FALSE, show_perc = TRUE, flip = FALSE)

Arguments

x
a data.frame
cluster
logical TRUE/FALSE. TRUE specifies that you want to use hierarchical clustering (mcquitty method) to arrange rows according to missingness. FALSE specifies that you want to leave it as is
sort_miss
logical TRUE/FALSE. TRUE arranges the columns in order of missingness
show_perc
logical TRUE/FALSE. TRUE now adds in the % of missing/complete data in the whole dataset into the legend. Default value is TRUE
flip
logical if TRUE, will flip the axis labels to be on top, resembling a dataframe

Examples

Run this code

library(visdat)

vis_miss(airquality)

vis_miss(airquality, cluster = TRUE)

vis_miss(airquality, sort_miss = TRUE)

# flip the axis to look more like a dataframe
vis_miss(airquality, flip = TRUE)

Run the code above in your browser using DataLab