Age grouper
age_grouper(age, interval = 10, min_age = 25, max_age = 75, breaks = NULL, labels = NULL, below = "Below\n", exp_min_age = 1L, exp_max_age = 100L, threshold = 10000L)
age | A numeric age (in years). |
---|---|
interval | How big should the age range be. 25-34 means interval = 10. |
min_age | What is the upper bound of the lowest bracket? ( |
max_age | What is the lower bound of the highest bracket? ( |
breaks | Specify breaks manually. |
labels | Specify the labels manually. |
below | String giving the prefix for the lowest bin. (Only applicable
if |
exp_min_age, exp_max_age | Integers specifying the lowest/highest expected
age in |
threshold | An integer, the minimum length at which the calculation will be accelerated. |
An ordered factor giving age ranges (separated by hyphens) as specified.
age_grouper(42)#> [1] 35-44 #> Levels: Below\n25 < 25-34 < 35-44 < 45-54 < 55-64 < 65-74 < 75+age_grouper(42, interval = 5, min_age = 20, max_age = 60)#> [1] 40-44 #> 10 Levels: Below\n20 < 20-24 < 25-29 < 30-34 < 35-39 < 40-44 < ... < 60+