# NOT RUN {
# Using time_quit_smoking_fun() to create pack-years values across CCHS
# cycles.
# time_quit_smoking_fun() is specified in variable_details.csv along with the
# CCHS variables and cycles included.
# To transform time_quit_smoking across cycles, use rec_with_table() for each
# CCHS cycle and specify time_quit_smoking, along with each smoking variable.
# Then by using merge_rec_data(), you can combine time_quit_smoking across
# cycles.
library(cchsflow)
time_quit2009_2010 <- rec_with_table(
cchs2009_2010_p, c(
"SMK_09A_B", "SMKG09C", "time_quit_smoking"
)
)
head(time_quit2009_2010)
time_quit2011_2012 <- rec_with_table(
cchs2011_2012_p, c(
"SMK_09A_B", "SMKG09C", "time_quit_smoking"
)
)
tail(time_quit2011_2012)
combined_time_quit <- suppressWarnings(merge_rec_data(time_quit2009_2010,
time_quit2011_2012))
head(combined_time_quit)
tail(combined_time_quit)
# }
Run the code above in your browser using DataLab