# Examples of svy_tbl group_by
library(survey)
data(api)
dstrata <- apistrat %>%
as_survey_design(strata = stype, weights = pw) %>%
group_by(stype)
dstrata %>%
summarise(api_diff = survey_mean(api00 - api99))
Run the code above in your browser using DataLab