Title: | Collect and Process Physical Activity Direct Observation Data |
---|---|
Description: | Two-part system for first collecting then managing direct observation data, as described by Hibbing PR, Ellingson LD, Dixon PM, & Welk GJ (2018) <doi:10.1249/MSS.0000000000001486>. |
Authors: | Paul R. Hibbing [aut, cre] |
Maintainer: | Paul R. Hibbing <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 0.3.0.9000 |
Built: | 2024-11-16 09:16:14 UTC |
Source: | https://github.com/paulhibbing/observation |
Consult the Compendium of Physical Activities to Encode Direct Observation Intensities
compendium_reference(obs_data, interactive = TRUE, ...)
compendium_reference(obs_data, interactive = TRUE, ...)
obs_data |
A data frame outputted from
|
interactive |
Logical. Should program be run interactively? |
... |
Additional arguments passed to method-like functions (under "See Also" below) |
A data frame fully annotated with intensity values
If 'interactive = TRUE', but R is not being used interactively, a message is issued and an override is implemented to set 'interactive = FALSE'.
Other processing functions:
interactive_compendium_reference()
,
manual_compendium_reference()
data(example_data) compendium_reference(example_data, FALSE, kids = "yes", mvpa = "yes") if (interactive()) { compendium_reference(example_data) }
data(example_data) compendium_reference(example_data, FALSE, kids = "yes", mvpa = "yes") if (interactive()) { compendium_reference(example_data) }
A generic-like function for collecting direct observation data manually or interactively, depending on user-specified preference and session capabilities.
data_collection_program(interactive = TRUE, ...)
data_collection_program(interactive = TRUE, ...)
interactive |
Logical. Should program be run interactively? |
... |
Additional arguments passed to method-like functions (under "See Also" below) |
If 'interactive = TRUE', but R is not being used interactively, a message is issued and an override is implemented to set 'interactive = FALSE'.
Other collection functions:
interactive_data_collection_program()
,
manual_data_collection_program()
if (interactive()) { data_collection_program() } # Load Sample of interactively-collected data for comparison # with manually-entered data data("example_data") # Example of manually defining input variables ------------------------- id <- "Test_ID" timestamps <- c("2018-05-06 02:40:37", "2018-05-06 02:40:46", "2018-05-06 02:40:59", "2018-05-06 02:41:14", "2018-05-06 02:41:27", "2018-05-06 02:41:37", "2018-05-06 02:41:48", "2018-05-06 02:42:03", "2018-05-06 02:42:24", "2018-05-06 02:42:39", "2018-05-06 02:42:53") activities <- c("sitting still", "sitting stretching", "sitting shoulder press", "sitting cycling", "standing still", "standing stretching", "standing shoulder press", "walking slowly", "walking quickly", "jumping jacks") durations <- c(9, 13, 15, 13, 10, 11, 15, 21, 15, 14.460825920105) Tree_Intensity <- c("Sedentary", "Sedentary/Light", "Light/Moderate", "Indeterminate", "Light", "Light", "Light/Moderate", "Light", "MVPA", "Light/Moderate") seated <- c("yes", "yes", "yes", "yes", "no", "no", "no", "no", "no", "no") large_muscles_moving <- c("no", "yes", "yes", "yes", "no", "yes", "yes", "yes", "yes", "yes") slow <- c(NA, "yes", "yes", "no", NA, "yes", "yes", "no", "no", "no") slowed_by_resistance <- c(NA, "no", "yes", NA, NA, "no", "yes", NA, NA, NA) ambulation <- c(NA, NA, NA, NA, NA, NA, NA, "yes", "yes", "no") light_walking <- c(NA, NA, NA, NA, NA, NA, NA, "yes", "no", NA) # Example of using the manual program ---------------------------------- manual_data <- data_collection_program( interactive = FALSE, id = id, timestamps = timestamps, activities = activities, durations = durations, seated = seated, large_muscles_moving = large_muscles_moving, slow = slow, slowed_by_resistance = slowed_by_resistance, ambulation = ambulation, light_walking = light_walking ) # Comparing output of interactive vs manual program -------------------- test_names <- intersect(names(example_data), names(manual_data)) test_names <- setdiff(names(test_names), "duration_s") all.equal( example_data[ ,test_names], manual_data[ ,test_names], scale = 1, tolerance = 5 )
if (interactive()) { data_collection_program() } # Load Sample of interactively-collected data for comparison # with manually-entered data data("example_data") # Example of manually defining input variables ------------------------- id <- "Test_ID" timestamps <- c("2018-05-06 02:40:37", "2018-05-06 02:40:46", "2018-05-06 02:40:59", "2018-05-06 02:41:14", "2018-05-06 02:41:27", "2018-05-06 02:41:37", "2018-05-06 02:41:48", "2018-05-06 02:42:03", "2018-05-06 02:42:24", "2018-05-06 02:42:39", "2018-05-06 02:42:53") activities <- c("sitting still", "sitting stretching", "sitting shoulder press", "sitting cycling", "standing still", "standing stretching", "standing shoulder press", "walking slowly", "walking quickly", "jumping jacks") durations <- c(9, 13, 15, 13, 10, 11, 15, 21, 15, 14.460825920105) Tree_Intensity <- c("Sedentary", "Sedentary/Light", "Light/Moderate", "Indeterminate", "Light", "Light", "Light/Moderate", "Light", "MVPA", "Light/Moderate") seated <- c("yes", "yes", "yes", "yes", "no", "no", "no", "no", "no", "no") large_muscles_moving <- c("no", "yes", "yes", "yes", "no", "yes", "yes", "yes", "yes", "yes") slow <- c(NA, "yes", "yes", "no", NA, "yes", "yes", "no", "no", "no") slowed_by_resistance <- c(NA, "no", "yes", NA, NA, "no", "yes", NA, NA, NA) ambulation <- c(NA, NA, NA, NA, NA, NA, NA, "yes", "yes", "no") light_walking <- c(NA, NA, NA, NA, NA, NA, NA, "yes", "no", NA) # Example of using the manual program ---------------------------------- manual_data <- data_collection_program( interactive = FALSE, id = id, timestamps = timestamps, activities = activities, durations = durations, seated = seated, large_muscles_moving = large_muscles_moving, slow = slow, slowed_by_resistance = slowed_by_resistance, ambulation = ambulation, light_walking = light_walking ) # Comparing output of interactive vs manual program -------------------- test_names <- intersect(names(example_data), names(manual_data)) test_names <- setdiff(names(test_names), "duration_s") all.equal( example_data[ ,test_names], manual_data[ ,test_names], scale = 1, tolerance = 5 )
A data set assembled by running the interactive direct observation program and entering a variety of activities.
example_data
example_data
A data frame with 10 rows and 15 variables:
The user-inputted identification code for the trial
The user-inputted start time for the activity
The automatic timestamp generated by button click, retained as a backup if an error occurs in User_Timestamp
The numeric day of the year (i.e., julian date)
The numeric minute of the day (e.g. 0 for midnight and 1439 for 23:59)
The user-inputted activity description
The duration of the activity (in seconds), based on User_Timestamp
The duration of the activity (in seconds), based on Auto_Timestamp
The pre-classified activity intensity, based on user input to the program's decision tree
User-inputted response to the seated prompt
User-inputted response to the large-muscles-moving prompt
User-inputted response to the slow prompt
User-inputted response to the slowed-by-resistance prompt
User-inputted response to the ambulation prompt
User-inputted response to the light-walking prompt
This provides a free and easy way to document and annotate physical activity behaviors using direct observation.
Hibbing PR, Ellingson LD, Dixon PM, & Welk GJ (2018). Adapted Sojourn Models to Estimate Activity Intensity in Youth: A Suite of Tools. Medicine and Science in Sports and Exercise. 50(4), 846-854. doi:10.1249/MSS.0000000000001486.
'Observation' functions accept further arguments that are passed to functions from the 'svDialogs' package. Doing so may improve your experience using the 'Observation' package. See the package vignette for more information.
# Example of non-interactive use data(example_data) compendium_reference(example_data, FALSE, kids = "yes", mvpa = "yes") # Example of interactive use if (interactive()) { observation_data <- data_collection_program() full_data <- compendium_reference(observation_data) }
# Example of non-interactive use data(example_data) compendium_reference(example_data, FALSE, kids = "yes", mvpa = "yes") # Example of interactive use if (interactive()) { observation_data <- data_collection_program() full_data <- compendium_reference(observation_data) }