tbl_svy object.
A tbl_svy
wraps a locally stored svydesign and adds methods for
dplyr single-table verbs like mutate
, group_by
and
summarise
. Create a tbl_svy
using as_survey_design
.
tbl_df
implements these methods from dplyr.
library(survey) library(dplyr) data(api) svy <- as_survey_design(apistrat, strata = stype, weights = pw) svy # Data manipulation verbs --------------------------------------------------- filter(svy, pcttest > 95) select(svy, starts_with("acs")) # variables used in survey design are automatically kept summarise(svy, col.grad = survey_mean(col.grad)) mutate(svy, api_diff = api00 - api99) # Group by operations ------------------------------------------------------- # To calculate survey svy_group <- group_by(svy, dname) summarise(svy, col.grad = survey_mean(col.grad), api00 = survey_mean(api00, vartype = "ci"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.