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 is for CCHS cycles (2005-2007) that use COPD & Emphysema as separate variables, as well as Bronchitis. Asthma is used across CCHS cycles as a separate variable.
resp_condition_fun2(DHHGAGE_cont, CCC_91E, CCC_91F, CCC_91A, CCC_031)
DHHGAGE_cont | continuous age variable. |
---|---|
CCC_91E | variable indicating if respondent has emphysema |
CCC_91F | variable indicating if respondent has COPD |
CCC_91A | variable indicating if respondent has chronic bronchitis |
CCC_031 | variable indicating if respondent has asthma |
a categorical variable (resp_condition_der) with 3 levels:
respondent is over the age of 35 and has a respiratory condition
respondent is under the age of 35 and has a respiratory condition
respondent does not have a respiratory condition
# Using resp_condition_fun2() to create values across CCHS cycles # (2005-2007) resp_condition_fun2() 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) resp2005 <- suppressWarnings(rec_with_table( cchs2005_p, c( "DHHGAGE_cont", "CCC_91E", "CCC_91F", "CCC_91A", "CCC_031", "resp_condition_der" ) ))#>#>#>#> CCC_031 CCC_91A CCC_91E CCC_91F DHHGAGE_cont resp_condition_der #> 1 2 2 NA(a) NA(a) 27 3 #> 2 2 2 2 2 77 3 #> 3 2 2 2 2 32 3 #> 4 2 2 2 2 77 3 #> 5 2 2 2 2 85 3 #> 6 2 2 NA(a) NA(a) 13 3resp2007_2008 <- suppressWarnings(rec_with_table( cchs2007_2008_p, c( "DHHGAGE_cont", "CCC_91E", "CCC_91F", "CCC_91A", "CCC_031", "resp_condition_der" ) ))#>#>#>#> CCC_031 CCC_91A CCC_91E CCC_91F DHHGAGE_cont resp_condition_der #> 195 2 2 2 2 62 3 #> 196 2 2 2 2 37 3 #> 197 2 2 2 2 77 3 #> 198 2 2 2 2 42 3 #> 199 2 2 2 2 32 3 #> 200 2 NA(b) 2 2 72 NA(b)#> CCC_031 CCC_91A CCC_91E CCC_91F DHHGAGE_cont resp_condition_der #> 1 2 2 NA(a) NA(a) 27 3 #> 2 2 2 2 2 77 3 #> 3 2 2 2 2 32 3 #> 4 2 2 2 2 77 3 #> 5 2 2 2 2 85 3 #> 6 2 2 NA(a) NA(a) 13 3#> CCC_031 CCC_91A CCC_91E CCC_91F DHHGAGE_cont resp_condition_der #> 395 2 2 2 2 62 3 #> 396 2 2 2 2 37 3 #> 397 2 2 2 2 77 3 #> 398 2 2 2 2 42 3 #> 399 2 2 2 2 32 3 #> 400 2 NA(b) 2 2 72 NA(b)