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 2007-2014.

active_transport2_fun(PAC_7, PAC_7A, PAC_7B_cont, PAC_8, PAC_8A, PAC_8B_cont)

Arguments

PAC_7

have walked to work or school in the past 3 months?

PAC_7A

number of times walked to work/school in the past 3 months.

PAC_7B_cont

number of minutes walk to work/school.

PAC_8

have biked to work or school in the past 3 months?

PAC_8A

number of times biked to work/school in the past 3 months.

PAC_8B_cont

number of minutes bike to work/school.

Value

Continuous variable for active transportation (active_transport)

Examples

# 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" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
head(active_transport2007_2008)
#> PAC_7 PAC_7A PAC_7B_cont PAC_8 PAC_8A PAC_8B_cont active_transport #> 1 3 NA NA 3 NA NA NA #> 2 2 NA NA 2 NA NA 0.000000 #> 3 1 90 45 2 NA NA 45.000000 #> 4 2 NA NA 2 NA NA 0.000000 #> 5 1 65 7 2 NA NA 5.055556 #> 6 2 NA NA 2 NA NA 0.000000
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" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
tail(active_transport2013_2014)
#> PAC_7 PAC_7A PAC_7B_cont PAC_8 PAC_8A PAC_8B_cont active_transport #> 195 3 NA NA 3 NA NA NA #> 196 3 NA NA 3 NA NA NA #> 197 1 60 23 2 NA NA 15.33333 #> 198 3 NA NA 3 NA NA NA #> 199 2 NA NA 2 NA NA 0.00000 #> 200 2 NA NA 2 NA NA 0.00000
combined_active_transport <- suppressWarnings(merge_rec_data( active_transport2007_2008, active_transport2013_2014)) head(combined_active_transport)
#> PAC_7 PAC_7A PAC_7B_cont PAC_8 PAC_8A PAC_8B_cont active_transport #> 1 3 NA NA 3 NA NA NA #> 2 2 NA NA 2 NA NA 0.000000 #> 3 1 90 45 2 NA NA 45.000000 #> 4 2 NA NA 2 NA NA 0.000000 #> 5 1 65 7 2 NA NA 5.055556 #> 6 2 NA NA 2 NA NA 0.000000
tail(combined_active_transport)
#> PAC_7 PAC_7A PAC_7B_cont PAC_8 PAC_8A PAC_8B_cont active_transport #> 395 3 NA NA 3 NA NA NA #> 396 3 NA NA 3 NA NA NA #> 397 1 60 23 2 NA NA 15.33333 #> 398 3 NA NA 3 NA NA NA #> 399 2 NA NA 2 NA NA 0.00000 #> 400 2 NA NA 2 NA NA 0.00000