# NOT RUN {
# Using SMKDSTY_fun() to derive smoke type values across CCHS cycles
# SMKDSTY_fun() is specified in variable_details.csv along with the
# CCHS variables and cycles included.
# To transform SMKDSTY_A across cycles, use rec_with_table() for each
# CCHS cycle and specify SMKDSTY_A.
# For CCHS 2001-2014, only specify SMKDSTY_A for smoker type.
# For CCHS 2015-2018, specify the parameters and SMKDSTY_A for smoker type.
library(cchsflow)
smoker_type_2009_2010 <- rec_with_table(
cchs2009_2010_p, "SMKDSTY_A")
head(smoker_type_2009_2010)
smoker_type_2017_2018 <- rec_with_table(
cchs2017_2018_p,c(
"SMK_01A", "SMK_005","SMK_030","SMKDSTY_A"
)
)
tail(smoker_type_2017_2018)
combined_smoker_type <- suppressWarnings(merge_rec_data
(smoker_type_2009_2010,smoker_type_2017_2018))
head(combined_smoker_type)
tail(combined_smoker_type)
# }
Run the code above in your browser using DataLab