Skip to content
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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Sedentary activity #114

wants to merge 4 commits into from

Conversation

kittychenn
Copy link
Collaborator

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 and SAC_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?

@kittychenn kittychenn linked an issue Feb 16, 2022 that may be closed by this pull request
Copy link
Contributor

@wyusuf068 wyusuf068 left a 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,
Copy link
Contributor

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 <-
Copy link
Contributor

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){
Copy link
Contributor

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").

#' @export

video_game_age2_fun <- function(DHHGAGE_cont, SAC_2D){
if_else2(DHHGAGE_cont <20, SAC_2D, if_else2(SAC_2D == "NA(a)",
Copy link
Contributor

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").

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")))
Copy link
Contributor

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 <-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above comment.

@kittychenn kittychenn added this to the V2.1 milestone Apr 13, 2022
@kittychenn kittychenn modified the milestones: V2.1, V2.2 Feb 21, 2023
@kittychenn kittychenn requested review from CBjerke and DougManuel and removed request for DougManuel and CBjerke February 22, 2023 18:09
@kittychenn
Copy link
Collaborator Author

@CBjerke @DougManuel I think this PR is okay to merge, but let me know what you think of the sedentary activity variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable request: sedentary behaviour
2 participants