Description Usage Arguments Value Examples
Collapse variable into groups and sum
1 2 3 4 5 6 7 8 |
.data |
A data frame; will honor grouping |
grp_list |
A named list of groups to collapse |
group |
Bare column name giving groups in data; will be converted to factor |
value |
Bare column name of values. Replaces |
moe |
Bare column name of margins of error; if supplied, MOEs of sums will be included in output |
estimate |
Soft deprecated; use |
A data frame/tibble with sums of estimate
. Retains grouping columns
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | edu_list <- list(ages25plus = 1, less_than_high_school = 2:16,
high_school = 17:18, some_college_or_aa = 19:21, bachelors_plus = 22:25)
edu_detail %>%
dplyr::group_by(name) %>%
add_grps(edu_list, group = variable, value = estimate, moe = moe)
edu_detail %>%
dplyr::group_by(name) %>%
add_grps(list(total = "ages25plus",
aa_or_bach = c("Associate's degree", "Bachelor's degree"),
bachelors_plus = c("Bachelor's degree", "Master's degree",
"Professional school degree", "Doctorate degree")),
value = estimate, group = variable, moe = moe)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.