data(api, package = "survey")
dstrata <- apistrat %>%
as_survey_design(strata = stype, weights = pw)
# The sum of the whole prop column is equal to 100%
dstrata %>%
group_by(interact(stype, awards)) %>%
summarize(prop = survey_mean())
# But if you didn't interact, the sum of each stype's prop is 100%
dstrata %>%
group_by(stype, awards) %>%
summarize(prop = survey_mean())
Run the code above in your browser using DataLab