Visualise a data.frame to display missingness.Source:
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.
vis_miss( x, cluster = FALSE, sort_miss = FALSE, show_perc = TRUE, show_perc_col = TRUE, large_data_size = 9e+05, warn_large_data = TRUE )
logical. 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. Default value is FALSE.
logical. TRUE arranges the columns in order of missingness. Default value is FALSE.
logical. TRUE now adds in the \ in the whole dataset into the legend. Default value is TRUE.
logical. TRUE adds in the \ column into the x axis. Can be disabled with FALSE. Default value is TRUE.
integer default is 900000 (given by `nrow(data.frame) * ncol(data.frame)``). This can be changed. See note for more details.
logical - warn if there is large data? Default is TRUE see note for more details
ggplot2 object displaying the position of missing values in the
dataframe, and the percentage of values missing and present.
Some datasets might be too large to plot, sometimes creating a blank plot - if this happens, I would recommend downsampling the data, either looking at the first 1,000 rows or by taking a random sample. This means that you won't get the same "look" at the data, but it is better than a blank plot! See example code for suggestions on doing this.