Travis-CI Build Status Coverage Status

srvyr brings parts of dplyr's syntax to survey analysis, using the survey package.

srvyr focuses on calculating summary statistics from survey data, such as the mean, total or quantile. It allows for the use of many dplyr verbs, such as summarize, group_by, and mutate, the convenience of pipe-able functions, lazyeval's style of non-standard evaluation and more consistent return types than the survey package.

You can try it out:

# or for development version
# devtools::install_github("gergness/srvyr")

To create a tbl_svy object (the core concept behind the srvyr package), use the function as_survey_design() with the bare column names of the names you would use in survey::svydesign() object.


dstrata <- apistrat %>%
   as_survey_design(strata = stype, weights = pw)

Now many of the dplyr verbs are available.

You can still use functions from the survey package if you'd like to:

svyglm(api99 ~ stype, dstrata)

If you'd like to contribute, please let me know! I started this as a way to learn about R package development, so you'll have to bear with me as I learn, but I would appreciate bug reports, pull requests or other suggestions!