sb_bout_dist: Extract features to summarize a participant's bout duration...

View source: R/get_bouts.R

sb_bout_distR Documentation

Extract features to summarize a participant's bout duration distribution

Description

Extract features to summarize a participant's bout duration distribution

Usage

sb_bout_dist(
  df = NULL,
  is_sb,
  is_wear,
  min_bout = 5,
  valid_indices = NULL,
  id = NULL,
  counts = NULL,
  wear = NULL,
  sb = 100,
  simplify = TRUE,
  probs = c(0.1, 0.2, 0.25, seq(0.3, 0.7, 0.1), 0.75, 0.8, 0.9)
)

Arguments

df

data frame of accelerometer input

is_sb

logical vector reflecting minute-by-minute classifications (TRUE for sedentary behavior and FALSE for non-sedentary behavior)

is_wear

logical vector reflecting minute-by-minute wear classifications (TRUE for wearing and FALSE for not wearing)

min_bout

integer scalar. Threshold for a run to qualify as a bout

valid_indices

integer vector (optional) specifying which indices of is_sb and is_wear correspond to valid measurement days (e.g. with 10+ hours of wear time on 4+ days)

id

character scalar (optional). Column name on which to divide object (if a data frame) into a list of separate objects

counts

character scalar. Column name of the variable to use when classifying sedentary behavior (and wear time, depending on the function)

wear

character scalar [optional]. Column name of the variable to use for determining wear time (logical vector with TRUE for wear time minutes). If no value is provided, nhanes_wear is invoked on the counts column

sb

integer. The cut point to use for classifying sedentary behavior

simplify

logical. If passing a data frame, setting to FALSE will return separate bout objects that can be passed into get_profile). Setting to TRUE will return an aggregated data frame through rbind and id_bind.

probs

numeric vector. Percentiles to calculate (all values must be between 0 and 1)

Details

This function can be used in one of two ways, either 1) by directly providing values for is_sb and is_wear (with df = NULL), or 2) by providing values for df and counts (optionally with wear as well).

Value

A bout object (data frame of distribution features)

Examples

data(example_data, package = "SBprofiles")
sb_bout_dist(
  is_sb = example_data$PAXINTEN <= 100,
  is_wear = nhanes_wear(example_data$PAXINTEN)
)
sb_bout_dist(
  example_data, id = "PAXDAY", counts = "PAXINTEN"
)

paulhibbing/SBprofiles documentation built on June 16, 2022, 3:31 a.m.