Description Usage Arguments See Also Examples
Takes the age group stored in age_group
and creates two variables,
age_min
and age_max
with the age boundaries of the group. By default,
separate_age_groups()
assumes that the age group definitions are separated
by a dash ("-"
), possibly with whitespace on either side. The separator
can be specified using the sep
argument.
1 2 | separate_age_groups(data, age_group = age_group, ...,
sep = "\\s*-\\s*", into = c("age_min", "age_max"))
|
data |
A data frame. |
age_group |
Unquoted column name containing the age grouping. |
... |
Not used other than to require explicit naming of arguments. |
sep |
Separator between columns. If character, is interpreted as a regular expression. The default value is a regular expression that matches any sequence of non-alphanumeric values. If numeric, interpreted as positions to split at. Positive values start
at 1 at the far-left of the string; negative value start at -1 at the
far-right of the string. The length of |
into |
Character vector of column names for separated |
format_age_groups()
for the specification of the age group label
format and to convert age boundaries into age group labels.
Other age processors: complete_age_groups
,
filter_age_groups
,
format_age_groups
,
recode_age_groups
,
standardize_age_groups
1 2 3 4 5 6 | d_age_group <- dplyr::tibble(
id = 1:4,
age_group = c("0 - 4", "10 - 14", "65 - 69", "85+")
)
separate_age_groups(d_age_group)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.