nice_missings_table.RdSummarizes missing values across user-defined scales in a data frame.
nice_missings_table(dat, scale, ...)A data frame containing the data to be analyzed.
A named list of character vectors. Each list element defines a scale
by specifying variable names (column names in dat) belonging to that scale.
Further arguments passed to the nice_table() function for formatting the output.
A data frame summarizing the missing value statistics for each scale with the following columns:
Number and percentage of missing values across variables in the scale.
Number and percentage of cases with no missing value in the scale.
Number and percentage of cases where all scale variables are missing.
This function is useful for assessing the extent of missing data within specific scales of a dataset. It provides insights into both the overall missings and the distribution of missing values across cases for each defined scale.
dat <- data.frame(
scale1_var1 = c(1, 2, NA, 4,NA),
scale1_var2 = c(NA, 2, NA, 4,NA),
scale2_var1 = c(1, NA, 3, 4, 1),
scale2_var2 = c(NA, NA, NA, 4, 1)
)
scales <- list(
scale1 = c("scale1_var1", "scale1_var2"),
scale2 = c("scale2_var1", "scale2_var2")
)
nice_missings_table(dat, scales)
n
%
n
%
n
%