Description Usage Arguments See Also Examples
This function helps to recode age groups into new groups that are equal to or overlap the original age grouping.
1 | recode_age_groups(data, breaks, age_group = age_group)
|
data |
A data frame, containin age group labels in the |
breaks |
The breaks at which the lower bounds of age groups should be
defined. If the first and last elements are |
age_group |
Unquoted column name containing the age grouping. |
Other age processors: complete_age_groups
,
filter_age_groups
,
format_age_groups
,
separate_age_groups
,
standardize_age_groups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | d_age_groups <- dplyr::tibble(
age_min = seq(0, 25, 5),
age_max = seq(4, 29, 5)
) %>%
format_age_groups()
d_age_groups
recode_age_groups(d_age_groups, breaks = c(10, 20, 25))
# Use maximum age in data for upper bound of highest group
recode_age_groups(d_age_groups, breaks = c(10, 20, 25, NA))
# Use minimum age in data for lower bound of lowest group
d_age_groups %>%
dplyr::filter(age_min >= 5) %>%
recode_age_groups(breaks = c(NA, 10, 20, 25))
# Dichotomize
recode_age_groups(d_age_groups, breaks = 20)
d_age_groups %>%
dplyr::filter(age_min >= 5) %>%
recode_age_groups(breaks = c(NA, 20, NA))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.