# NOT RUN {
# Using active_transport2_fun() to determine daily time spent
# traveling in active ways values across CCHS 2007-2014.
# active_transport2_fun() is specified in variable_details.csv along with the CCHS
# variables and cycles included.
# To transform active_transport across cycles, use rec_with_table() for each
# CCHS cycle and specify active_transport, along with each activity variable.
# Then by using merge_rec_data(), you can combine active_transport across
# cycles
library(cchsflow)
active_transport2007_2008 <- rec_with_table(
cchs2007_2008_p, c(
"PAC_7", "PAC_7A", "PAC_7B_cont", "PAC_8", "PAC_8A", "PAC_8B_cont",
"active_transport"
)
)
head(active_transport2007_2008)
active_transport2013_2014 <- rec_with_table(
cchs2013_2014_p, c(
"PAC_7", "PAC_7A", "PAC_7B_cont", "PAC_8", "PAC_8A", "PAC_8B_cont",
"active_transport"
)
)
tail(active_transport2013_2014)
combined_active_transport <- suppressWarnings(merge_rec_data(
active_transport2007_2008, active_transport2013_2014))
head(combined_active_transport)
tail(combined_active_transport)
# }
Run the code above in your browser using DataLab