age_cat_fun: Derived categorical age

Description Usage Arguments Details Value Examples

View source: R/age-categorical.R

Description

This is a derived categorical age variable (DHHGAGE_C) that groups various age categories across all CCHS cycles. This is based on the continuous age variable (DHHGAGE_cont) that is harmonious across all CCHS cycles.

The categories of this new age variable are as follows:

  1. 12 to 14 years

  2. 15 to 17 years

  3. 18 to 19 years

  4. 20 to 24 years

  5. 25 to 29 years

  6. 30 to 34 years

  7. 35 to 39 years

  8. 40 to 44 years

  9. 45 to 49 years

  10. 50 to 54 years

  11. 55 to 59 years

  12. 60 to 64 years

  13. 65 to 69 years

  14. 70 to 74 years

  15. 75 to 79 years

  16. 80 years or more

Usage

1
age_cat_fun(DHHGAGE_cont)

Arguments

DHHGAGE_cont

continuous age variable

Details

The categories in the grouped age variable (DHHGAGE) vary between CCHS cycles. As such, a continuous age variable (DHHGAGE_cont) was created that harmonized age across all CCHS cycles by taking the midpoint of each age category. This new age variable (DHHGAGE_C) categorizes age based on the categories used in CCHS cycles from 2007 to 2014.

Value

a categorical age variable (DHHGAGE_C)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Using age_cat_fun() to create categorical age values from DHHGAGE_cont
# age_cat_fun() is specified in variable_details.csv along with the CCHS
# variables and cycles included.

# To generate DHHGAGE_C in a cycle, use rec_with_table() and specify
# DHHGAGE_C along with DHHGAGE_cont.

library(cchsflow)

cat_age2009_2010 <- rec_with_table(
   cchs2009_2010_p,  c(
     "DHHGAGE_cont", "DHHGAGE_C"
     )
   )

cchsflow documentation built on June 24, 2021, 1:07 a.m.