Package 'Observation'

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

Help Index


Consult the Compendium of Physical Activities to Encode Direct Observation Intensities

Description

Consult the Compendium of Physical Activities to Encode Direct Observation Intensities

Usage

compendium_reference(obs_data, interactive = TRUE, ...)

Arguments

obs_data

A data frame outputted from data_collection_program

interactive

Logical. Should program be run interactively?

...

Additional arguments passed to method-like functions (under "See Also" below)

Value

A data frame fully annotated with intensity values

Note

If 'interactive = TRUE', but R is not being used interactively, a message is issued and an override is implemented to set 'interactive = FALSE'.

See Also

Other processing functions: interactive_compendium_reference(), manual_compendium_reference()

Examples

data(example_data)

compendium_reference(example_data, FALSE, kids = "yes", mvpa = "yes")
if (interactive()) {
    compendium_reference(example_data)
}

Collect Direct Observation Data

Description

A generic-like function for collecting direct observation data manually or interactively, depending on user-specified preference and session capabilities.

Usage

data_collection_program(interactive = TRUE, ...)

Arguments

interactive

Logical. Should program be run interactively?

...

Additional arguments passed to method-like functions (under "See Also" below)

Note

If 'interactive = TRUE', but R is not being used interactively, a message is issued and an override is implemented to set 'interactive = FALSE'.

See Also

example_data

Other collection functions: interactive_data_collection_program(), manual_data_collection_program()

Examples

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
)

Sample data collected interactively with direct observation program.

Description

A data set assembled by running the interactive direct observation program and entering a variety of activities.

Usage

example_data

Format

A data frame with 10 rows and 15 variables:

id

The user-inputted identification code for the trial

User_Timestamp

The user-inputted start time for the activity

Auto_Timestamp

The automatic timestamp generated by button click, retained as a backup if an error occurs in User_Timestamp

dayofyear

The numeric day of the year (i.e., julian date)

minofday

The numeric minute of the day (e.g. 0 for midnight and 1439 for 23:59)

Activity

The user-inputted activity description

duration_s

The duration of the activity (in seconds), based on User_Timestamp

auto_duration_s

The duration of the activity (in seconds), based on Auto_Timestamp

Tree_Intensity

The pre-classified activity intensity, based on user input to the program's decision tree

seated

User-inputted response to the seated prompt

large_muscles_moving

User-inputted response to the large-muscles-moving prompt

slow

User-inputted response to the slow prompt

slowed_by_resistance

User-inputted response to the slowed-by-resistance prompt

ambulation

User-inputted response to the ambulation prompt

light_walking

User-inputted response to the light-walking prompt


Collect and Process Physical Activity Direct Observation Data

Description

This provides a free and easy way to document and annotate physical activity behaviors using direct observation.

Core functions

data_collection_program

compendium_reference

Associated References

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.

Note

'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.

Examples

# 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)
}