Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cascade

Summarise multiple values into cascading groups


Description

cascade is similar to summarise, but calculates a summary statistics for the total of a group in addition to each group.

Usage

cascade(.data, ..., .dots, .fill = NA)

Arguments

.data,

tbl A tbl_svy object

...

Name-value pairs of summary functions

.dots

Used to work around non-standard evaluation. See vignette("nse", package = "dplyr") for details.

.fill

Value to fill in for group summaries

Examples

library(survey)
data(api)

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

dstrata_grp <- dstrata %>%
  group_by(stype)

dstrata_grp %>%
  cascade(api99_mn = survey_mean(api99),
            api00_mn = survey_mean(api00),
            api_diff = survey_mean(api00 - api99))

srvyr

'dplyr'-Like Syntax for Summary Statistics of Survey Data

v1.0.1
GPL-2 | GPL-3
Authors
Greg Freedman Ellis [aut, cre], Thomas Lumley [ctb], Tomasz Żółtak [ctb], Ben Schneider [aut, ctb], Pavel N. Krivitsky [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.