Discretize a vector of age integers into labelled variables

ccc_bin_age(agevec, agelbl = deframe(ccesMRPprep::age5_key))

## Arguments

agevec

a vector of integers

agelbl

a value-key pair to be passed into recode, with values as the things to be recoded and labels as the labels for each value.

## Details

The recoding is governed by age5_key. IT currently only accepts 5-way binning, following the ACS.

## Examples

  ccc_bin_age(c(15:100, NA))
#> <labelled<integer>[87]>
#>  [1] NA NA NA  1  1  1  1  1  1  1  2  2  2  2  2  2  2  2  2  2  3  3  3  3  3
#> [26]  3  3  3  3  3  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
#> [51]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
#> [76]  5  5  5  5  5  5  5  5  5  5  5 NA
#>
#> Labels:
#>  value             label
#>      1    18 to 24 years
#>      2    25 to 34 years
#>      3    35 to 44 years
#>      4    45 to 64 years
#>      5 65 years and over