This is one of 3 functions used to create a derived variable (resp_condition_der) that determines if a respondents has a respiratory condition. 3 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 (2009-2014) that only use COPD and Emphysema as a combined variable. Asthma is used across CCHS cycles as a separate variable.

resp_condition_fun1(DHHGAGE_cont, CCC_091, CCC_031)

Arguments

DHHGAGE_cont

continuous age variable.

CCC_091

variable indicating if respondent has either COPD or Emphysema

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

Examples

# Using resp_condition_fun1() to create values across CCHS cycles # (2009-2014) resp_condition_fun1() 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) resp2009_2010 <- suppressWarnings(rec_with_table( cchs2009_2010_p, c( "DHHGAGE_cont", "CCC_091", "CCC_031", "resp_condition_der" ) ))
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
head(resp2009_2010)
#> CCC_031 CCC_091 DHHGAGE_cont resp_condition_der #> 1 2 NA(a) 13 3 #> 2 2 NA(a) 27 3 #> 3 2 2 62 3 #> 4 2 2 52 3 #> 5 2 2 67 3 #> 6 2 2 62 3
resp2011_2012 <- suppressWarnings(rec_with_table( cchs2011_2012_p, c( "DHHGAGE_cont", "CCC_091", "CCC_031", "resp_condition_der" ) ))
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
tail(resp2011_2012)
#> CCC_031 CCC_091 DHHGAGE_cont resp_condition_der #> 195 2 2 72.0 3 #> 196 2 NA(a) 22.0 3 #> 197 2 NA(a) 18.5 3 #> 198 2 2 42.0 3 #> 199 2 2 62.0 3 #> 200 2 2 52.0 3
combined_resp <- suppressWarnings(merge_rec_data(resp2009_2010, resp2011_2012)) head(combined_resp)
#> CCC_031 CCC_091 DHHGAGE_cont resp_condition_der #> 1 2 NA(a) 13 3 #> 2 2 NA(a) 27 3 #> 3 2 2 62 3 #> 4 2 2 52 3 #> 5 2 2 67 3 #> 6 2 2 62 3
tail(combined_resp)
#> CCC_031 CCC_091 DHHGAGE_cont resp_condition_der #> 395 2 2 72.0 3 #> 396 2 NA(a) 22.0 3 #> 397 2 NA(a) 18.5 3 #> 398 2 2 42.0 3 #> 399 2 2 62.0 3 #> 400 2 2 52.0 3