This function creates a derived variable for daily time spent traveling in active ways. This includes walking and biking. This function is used for CCHS 2001-2005.

active_transport1_fun(PAC_4A_cont, PAC_4B_cont)

Arguments

PAC_4A_cont

number of hours walk work/school in week in the past 3 months.

PAC_4B_cont

number of hours bike work/school in week in the past 3 months.

Value

Continuous variable for active transportation (active_transport)

Examples

# Using active_transport1_fun() to determine daily time spent # traveling in active ways values across CCHS 2001-2005. # active_transport1_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_transport2001 <- rec_with_table( cchs2001_p, c( "PAC_4A_cont", "PAC_4B_cont", "active_transport" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
head(active_transport2001)
#> PAC_4A_cont PAC_4B_cont active_transport #> 1 21.0 0 3.00000000 #> 2 0.0 0 0.00000000 #> 3 0.5 0 0.07142857 #> 4 21.0 0 3.00000000 #> 5 3.0 0 0.42857143 #> 6 0.0 0 0.00000000
active_transport2005 <- rec_with_table( cchs2005_p, c( "PAC_4A_cont", "PAC_4B_cont", "active_transport" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
tail(active_transport2005)
#> PAC_4A_cont PAC_4B_cont active_transport #> 195 0.0 0 0.00000000 #> 196 0.5 0 0.07142857 #> 197 8.0 3 1.57142857 #> 198 3.0 0 0.42857143 #> 199 0.5 0 0.07142857 #> 200 21.0 0 3.00000000
combined_active_transport <- suppressWarnings(merge_rec_data(active_transport2001, active_transport2005)) head(combined_active_transport)
#> PAC_4A_cont PAC_4B_cont active_transport #> 1 21.0 0 3.00000000 #> 2 0.0 0 0.00000000 #> 3 0.5 0 0.07142857 #> 4 21.0 0 3.00000000 #> 5 3.0 0 0.42857143 #> 6 0.0 0 0.00000000
tail(combined_active_transport)
#> PAC_4A_cont PAC_4B_cont active_transport #> 395 0.0 0 0.00000000 #> 396 0.5 0 0.07142857 #> 397 8.0 3 1.57142857 #> 398 3.0 0 0.42857143 #> 399 0.5 0 0.07142857 #> 400 21.0 0 3.00000000