Converts the age27 variable in MCOD data to 5-year age groups
Source:R/convert_ager27.R
convert_ager27.RdConverts the age27 variable in MCOD data to 5-year age groups
Details
Expects `ager27` in its documented domain (codes 1-27, where 27 is "age not stated" and maps to `NA`). A non-`NA` value outside 1-27 triggers a warning, since it would otherwise collapse silently into the 85+ bin or produce a negative age.
Examples
df <- data.frame(ager27 = c(1, 10, 23, 27))
convert_ager27(df)
#> age
#> 1 0
#> 2 20
#> 3 85
#> 4 NA