# Load required packages and data
library(dplyr)
data(survey_data)
# Compare three trust items (rated by same respondents)
survey_data %>%
friedman_test(trust_government, trust_media, trust_science)
# Using tidyselect helpers
survey_data %>%
friedman_test(starts_with("trust_"))
# Weighted analysis
survey_data %>%
friedman_test(trust_government, trust_media, trust_science,
weights = sampling_weight)
# Grouped analysis (separate test per region)
survey_data %>%
group_by(region) %>%
friedman_test(trust_government, trust_media, trust_science)
Run the code above in your browser using DataLab