library(dplyr)
data(survey_data)
# Build an example set: which institutions does a respondent
# trust highly (rating of 4 or 5)?
trust <- survey_data %>%
mutate(
gov = as.integer(trust_government >= 4),
media = as.integer(trust_media >= 4),
science = as.integer(trust_science >= 4)
)
# Frequencies table: % of responses vs. % of cases
multiple_response(trust, gov, media, science)
# Crossed against gender, with weights
multiple_response(trust, gov, media, science,
by = gender, weights = sampling_weight)
# --- Three-layer output ---
result <- multiple_response(trust, gov, media, science)
result # compact overview
summary(result) # full detailed output
Run the code above in your browser using DataLab