Description Usage Arguments Details Value See Also Examples
Given a vector of age group labels, create a factor
that contains levels for all ages between break_min
and break_max. The labels may contain an open age group,
ie an age group with no upper limit. Apart from the open age
group, all the age groups have a width of one quarter
(three months).
| 1 | format_age_quarter(x, break_min = 0, break_max = 400, open_last = TRUE)
 | 
| x | A vector of age group labels. | 
| break_min | An integer or  | 
| break_max | An integer or  | 
| open_last | Whether the final age group
has no upper limit. Defaults to  | 
Even when an age
group between break_min and break_max
is not included in x, factor_quarter
still creates a level for it.
If break_min or break_max is set to NULL,
rather than to a specific value, then format_age_year
finds the narrowest range that accommodates the data.
If x contains NA, then the
levels of the factor created by format_age_quarter
also contain NA.
A factor with the same length as x.
Other functions for creating age groups are
format_age_year
format_age_multi
format_age_lifetab
format_age_births
format_age_custom
format_age_month
date_to_age_quarter calculates
ages from dates.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | format_age_quarter(x = c(0, 21, 5))
format_age_quarter(x = c("10", "22", "500+"))
## specify highest age group
format_age_quarter(x = c("10", "22", "500+"),
                   break_max = 48)
## let lowest age group be determined by the data
format_age_quarter(x = c("10", "22", "500+"),
                   break_min = NULL,
                   break_max = 48)
## make final age group closed
format_age_quarter(x = c("10", "22"),
                   break_min = NULL,
                   break_max = 48,
                   open_last = FALSE)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.