COPD_Emph_der_fun2: COPD_Emph_der_fun2

Description Usage Arguments Value See Also Examples

View source: R/respiratory-condition.R

Description

This is one of 2 functions used to create a derived variable (COPD_Emph_der) that determines if a respondents has either COPD or Emphysema. 2 different functions have been created to account for the fact that different respiratory variables are used across CCHS cycles. This function is for CCHS cycles (2001-2003, 2009-2014) that use COPD and Emphysema as a combined variable.

Usage

1
COPD_Emph_der_fun2(DHHGAGE_cont, CCC_091)

Arguments

DHHGAGE_cont

continuous age variable.

CCC_091

variable indicating if respondent has either COPD or Emphysema

Value

a categorical variable (COPD_Emph_der) with 3 levels:

  1. respondent is over the age of 35 and has a respiratory condition

  2. respondent is under the age of 35 and has a respiratory condition

  3. respondent does not have a respiratory condition

See Also

COPD_Emph_der_fun2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# COPD_Emph_der_fun2() to create values across CCHS cycles
# (2001-2003, 2009-2014) COPD_Emph_der_fun2() is specified in
# variable_details.csv along with the CCHS variables and cycles included.

# To transform COPD_Emph_der, use rec_with_table() for each CCHS cycle
# and specify COPD_Emph_der, along with the various respiratory
# variables. Then by using merge_rec_data() you can combine COPD_Emph_der
# across cycles.

library(cchsflow)

COPD2001 <- suppressWarnings(rec_with_table(
  cchs2001_p,  c(
    "DHHGAGE_cont", "CCC_091",
    "COPD_Emph_der"
  )
))

head(COPD2001)

COPD2014 <- suppressWarnings(rec_with_table(
  cchs2007_2008_p, c(
    "DHHGAGE_cont", "CCC_091", 
    "COPD_Emph_der"
  )
))

tail(COPD2014)

combined_COPD <- suppressWarnings(merge_rec_data(COPD2001, COPD2014))

head(combined_COPD)
tail(combined_COPD)

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