# Load required packages and data
library(dplyr)
data(survey_data)
# Compare trust in government vs trust in media
survey_data %>%
wilcoxon_test(x = trust_government, y = trust_media)
# Weighted analysis
survey_data %>%
wilcoxon_test(x = trust_government, y = trust_media,
weights = sampling_weight)
# Grouped analysis (separate test per region)
survey_data %>%
group_by(region) %>%
wilcoxon_test(x = trust_government, y = trust_media)
Run the code above in your browser using DataLab