-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sedentary activity #114
base: dev
Are you sure you want to change the base?
Sedentary activity #114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. See comments about respondents above or below age limit.
|
||
weekly_screen_time_age1_fun <- | ||
function(DHHGAGE_cont, SBE_010) { | ||
if_else2(!is.na(SBE_010) & DHHGAGE_cont >=20, SBE_010*7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're restricting to respondents over 20, I would add another condition where respondents under 20 that do not have an NA value for SBE_10 are set to tagged_na("a").
#' tail(weekly_st_B_2017_2018) | ||
#' @export | ||
#' | ||
weekly_screen_time_age2_fun <- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to weekly_screen_time_age1_fun, respondents over 20 with a non-NA SBE_010 value should be set to tagged_na("a").
#' tail(combined_vg_A) | ||
#' @export | ||
|
||
video_game_age1_fun <- function(DHHGAGE_cont, SAC_2D){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would set respondents under 20 with a non-NA SAC_2D value to tagged_na("a").
R/sedentary-activity.R
Outdated
#' @export | ||
|
||
video_game_age2_fun <- function(DHHGAGE_cont, SAC_2D){ | ||
if_else2(DHHGAGE_cont <20, SAC_2D, if_else2(SAC_2D == "NA(a)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would set respondents over 20 with a non-NA SAC_2D value to tagged_na("a").
R/sedentary-activity.R
Outdated
SAC_1 + SAC_2_A + SAC_3 + SAC_4, | ||
if_else2(SAC_1 == "NA(a)"| SAC_2_A == "NA(a)"| | ||
SAC_3 == "NA(a)"| SAC_4== "NA(a)", | ||
tagged_na("a"), tagged_na("b"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an if_else for respondents under 20.
#' tail(combined_sed_act2) | ||
#' @export | ||
|
||
sedentary_activity2_fun <- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above comment.
@CBjerke @DougManuel I think this PR is okay to merge, but let me know what you think of the sedentary activity variables |
Sedentary activities in CCHS cycles include time on computer, time playing video games, time watching tv or videos, and time spent reading. There is a slight variation in age groups for video games, so there are two variables for ages <20 and 20+ (
SAC_2_B
andSAC_2_A
).Total time spent doing sedentary activities adds the four activities. There is also another function that adds all activities except for reading. Total time spent is limited to age 20+. I could add total time spent for age <20 if needed.
For CCHS 2017-2018, sedentary activity was changed to daily screen time. A derived variable for weekly screen time was created, as well as age restrictions (<20 and 20+). Should I add weekly leisure screen time to the total time spent doing sedentary activities function?