# NOT RUN {
library(dplyr)
# Examples of too many combinations
diagnose_sparese(jobchange)
# Character type is also included in the combination variable
diagnose_sparese(jobchange, add_character = TRUE)
# Combination of two variables
jobchange %>%
diagnose_sparese(education_level, major_discipline)
# Remove two categorical variables from combination
jobchange %>%
diagnose_sparese(-city, -education_level)
diagnose_sparese(heartfailure)
# Adjust the threshold of limt to calculate
diagnose_sparese(heartfailure, limit = 50)
# List all combinations, including parese cases
diagnose_sparese(heartfailure, type = "all")
# collaboration with dplyr
heartfailure %>%
diagnose_sparese(type = "all") %>%
arrange(desc(n_case)) %>%
mutate(percent = round(n_case / sum(n_case) * 100, 1))
# }
Run the code above in your browser using DataLab