Convert age group labels to a less detailed classification.
The three classifications recognized by combine_age()
are "single", "five", and "lt", as defined on
age_labels(). The following conversions are permitted:
"single"—>"lt""single"—>"five""lt"—>"five"
Usage
combine_age(x, to = c("five", "lt"))Value
If x is a factor, then combine_age()
returns a factor; otherwise it returns a
character vector.
See also
age_labels()to create age group labelsreformat_age()to convert existing age group labels to a standard formatset_age_open()to set the lower limit of the open age group
Examples
x <- c("0", "5", "3", "12")
combine_age(x)
#> [1] "0-4" "5-9" "0-4" "10-14"
combine_age(x, to = "lt")
#> [1] "0" "5-9" "1-4" "10-14"
