Conversation
wyusuf068
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.
Add an if_else for respondents under 20.
| #' tail(combined_sed_act2) | ||
| #' @export | ||
|
|
||
| sedentary_activity2_fun <- |
There was a problem hiding this comment.
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 |
DougManuel
left a comment
There was a problem hiding this comment.
I finally caught up to the PR. Looks good.
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_BandSAC_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?