Take a text representation of an age bracket, such as '30-40' and translate it into an ordered factor compatible with the global age_brackets variable.

decode_age_bracket(x)

Arguments

x

A character or factor vector containing one or more age bracket descriptions equivalent to levels of the age_brackets variable.

Value

An ordered factor

Examples

decode_age_bracket(c("0-19", "30-39"))
#> [1] 0-19 30-39 #> Levels: 0-19 < 20-29 < 30-39 < 40-49 < 50-59 < 60-69 < 70-79 < 80+