resp_condition_fun3: resp_condition_fun3

View source: R/respiratory-condition.R

resp_condition_fun3R Documentation

resp_condition_fun3

Description

This is one of 3 functions used to create a derived variable (resp_condition_der) that determines if a respondents has a respiratory condition. This function for CCHS cycles (2001-2003) that use COPD and Emphysema as a combined variable, as well as Bronchitis. Asthma is used across CCHS cycles as a separate variable.

Usage

resp_condition_fun3(DHHGAGE_cont, CCC_091, CCC_91A, CCC_031)

Arguments

DHHGAGE_cont

continuous age variable.

CCC_091

variable indicating if respondent has either COPD or Emphysema

CCC_91A

variable indicating if respondent has chronic bronchitis

CCC_031

variable indicating if respondent has asthma

Value

a categorical variable (resp_condition_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

resp_condition_fun1, resp_condition_fun2

Examples

# Using resp_condition_fun3() to create values across CCHS cycles
# (2001-2003) resp_condition_fun3() is specified in
# variable_details.csv along with the CCHS variables and cycles included.

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

library(cchsflow)

resp2001 <- suppressWarnings(rec_with_table(
  cchs2001_p, c(
    "DHHGAGE_cont", "CCC_091", "CCC_91A", "CCC_031",
    "resp_condition_der"
  )
))

head(resp2001)

resp2003 <- suppressWarnings(rec_with_table(
  cchs2003_p,c(
    "DHHGAGE_cont", "CCC_091", "CCC_91A", "CCC_031",
    "resp_condition_der"
  )
))

tail(resp2003)

combined_resp <- suppressWarnings(merge_rec_data(resp2001, resp2003))

head(combined_resp)
tail(combined_resp)

cchsflow documentation built on May 28, 2022, 1:09 a.m.