active_transport3_fun: Daily active transportation (2015-2018)

View source: R/active-transportation.R

active_transport3_funR Documentation

Daily active transportation (2015-2018)

Description

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 2015-2018.

Usage

active_transport3_fun(PAYDVTTR, PAADVTRV)

Arguments

PAYDVTTR

number of minutes of active transportation in a week for 12-17 years old.

PAADVTRV

number of minutes of active transportation in a week for 18+ years old.

Value

Continuous variable for active transportation (active_transport)

Examples

# Using active_transport3_fun() to determine daily time spent 
# traveling in active ways values across CCHS 2015-2018.

# active_transport3_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_transport2015_2016 <- rec_with_table(
  cchs2015_2016_p, c(
    "PAYDVTTR", "PAADVTRV","active_transport"
  )
)

head(active_transport2015_2016)

active_transport2017_2018 <- rec_with_table(
  cchs2017_2018_p, c(
    "PAYDVTTR", "PAADVTRV","active_transport"
  )
)

tail(active_transport2017_2018)

combined_active_transport <- suppressWarnings(merge_rec_data(
 active_transport2015_2016, active_transport2017_2018))

head(combined_active_transport)
tail(combined_active_transport)

cchsflow documentation built on May 28, 2022, 1:09 a.m.