internal_functions: Functions used internally in the package

sb_bout_dist_defaultR Documentation

Functions used internally in the package

Description

Functions used internally in the package

Usage

sb_bout_dist_default(
  is_sb,
  is_wear,
  min_bout = 5,
  valid_indices = NULL,
  probs = c(0.1, 0.2, 0.25, seq(0.3, 0.7, 0.1), 0.75, 0.8, 0.9)
)

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

df_check_format(df, counts, valid_indices, id, wear)

counts_verify(df, counts)

valid_indices_verify(df, valid_indices)

id_wear_time_verify(df, id, wear)

id_verify(df, id)

id_bind(result, id, simplify = TRUE)

Arguments

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)

probs

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

df

data frame of accelerometer input

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

id

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

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.

result

output that may need data frame formatting (possibly ID-based)

Details

The purpose of id_wear_time_verify is to determine if the Choi wear time algorithm needs to be run and, if so, to run it (via nhanes_wear, with a message). To bypass, run df$is_wear <- TRUE prior to executing id_wear_time_verify(df, id, wear = "is_wear").

df_check_format is a wrapper that encompasses


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