# Load required packages and data
library(dplyr)
data(survey_data)
# Basic categorical analysis
survey_data %>% frequency(gender)
# Multiple variables with weights
survey_data %>% frequency(gender, region, weights = sampling_weight)
# Grouped analysis by region
survey_data %>%
group_by(region) %>%
frequency(gender, weights = sampling_weight)
# Education levels with sorting
survey_data %>% frequency(education, sort_frq = "desc")
# Employment status with custom display options
survey_data %>% frequency(employment, weights = sampling_weight,
show_na = TRUE, show_sum = TRUE)
Run the code above in your browser using DataLab