Nothing
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(countmaskr) library(knitr)

data("countmaskr_data") aggregate_table <- countmaskr_data %>% select(-c(id, age)) %>% gather(block, Characteristics) %>% group_by(block, Characteristics) %>% summarise(N = n()) %>% ungroup()
aggregate_table %>% group_by(block) %>% mutate(N_masked = mask_counts(N)) %>% kable()
aggregate_table %>% group_by(block) %>% mutate(N_masked = mask_counts_2(N)) %>% kable()
aggregate_table %>% group_by(block) %>% mutate(N_masked = perturb_counts(N)) %>% kable()
mask_table()mask_table() is a multi-tasking function which allows for masking, obtaining original and masked percentages on an aggregated table.
mask_table(aggregate_table, group_by = "block", col_groups = list("N")) %>% kable()
Naming convention for the masked columns follow {col}_N_masked pattern.
mask_table( aggregate_table, group_by = "block", col_groups = list("N"), overwrite_columns = FALSE ) %>% kable()
Naming convention for the original and masked percentages follow {col}_perc and {col}_perc_masked pattern.
mask_table( aggregate_table, group_by = "block", col_groups = list("N"), overwrite_columns = TRUE, percentages = TRUE ) %>% kable()
two_way_freq_table <- countmaskr_data %>% count(race, gender) %>% pivot_wider(names_from = gender, values_from = n) %>% mutate( across(all_of(c("Female", "Male", "Other")), ~ ifelse(is.na(.), 0, .)), Overall = Female + Male + Other, .after = 1 ) mask_table( two_way_freq_table, col_groups = list(c("Overall", "Female", "Male", "Other")), overwrite_columns = TRUE, percentages = FALSE ) %>% kable()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.