process_tri {accelerometry}  R Documentation 
Process Triaxial MinutetoMinute Accelerometer Data
Description
Calculates a variety of physical activity variables based on triaxial minutetominute accelerometer count values for individual participants. Assumes first 1440 minutes are day 1, next 1440 are day 2, and so on. If final day has less than 1440 minutes, it is excluded. A data dictionary for the variables created is available here: https://github.com/vandomed/accelerometry/blob/master/process_tri_dictionary.csv.
Usage
process_tri(counts, steps = NULL, nci_methods = FALSE, start_day = 1,
start_date = NULL, id = NULL, brevity = 1, hourly_var = "cpm",
hourly_wearmin = 0, hourly_normalize = FALSE, valid_days = 1,
valid_wk_days = 0, valid_we_days = 0, int_axis = "vert",
int_cuts = c(100, 760, 2020, 5999), cpm_nci = FALSE,
days_distinct = FALSE, nonwear_axis = "vert", nonwear_window = 60,
nonwear_tol = 0, nonwear_tol_upper = 99, nonwear_nci = FALSE,
weartime_minimum = 600, weartime_maximum = 1440,
active_bout_length = 10, active_bout_tol = 0, mvpa_bout_tol_lower = 0,
vig_bout_tol_lower = 0, active_bout_nci = FALSE, sed_bout_tol = 0,
sed_bout_tol_maximum = int_cuts[2]  1, artifact_axis = "vert",
artifact_thresh = 25000, artifact_action = 1, weekday_weekend = FALSE,
return_form = "daily")
Arguments
counts 
Integer matrix with three columns of count values, e.g. verticalaxis counts, anteroposterior (AP)axis counts, and mediolateral (ML)axis counts. 
steps 
Integer vector with steps. 
nci_methods 
Logical value for whether to set all arguments so as to replicate the data processing methods used in the NCI's SAS programs. More specifically:
If 
start_day 
Integer value specifying day of week for first day of monitoring, with 1 = Sunday, ..., 7 = Satuday. 
start_date 
Date for first day of monitoring, which function can use to
figure out 
id 
Numeric value specifying ID number of participant. 
brevity 
Integer value controlling the number of physical activity variables generated. Choices are 1 for basic indicators of physical activity volume, 2 for addditional indicators of activity intensities, activity bouts, sedentary behavior, and peak activity, and 3 for additional hourly count averages. 
hourly_var 
Character string specifying what hourly activity variable
to record, if 
hourly_wearmin 
Integer value specifying minimum number of wear time minutes needed during a given hour to record a value for the hourly activity variable. 
hourly_normalize 
Logical value for whether to normalize hourly activity by number of wear time minutes. 
valid_days 
Integer value specifying minimum number of valid days to be considered valid for analysis. 
valid_wk_days 
Integer value specifying minimum number of valid weekdays to be considered valid for analysis. 
valid_we_days 
Integer value specifying minimum number of valid weekend days to be considered valid for analysis. 
int_axis 
Character string specifying which axis should be used to classify intensities. Choices are "vert", "ap", "ml", "sum" (for triaxial sum), and "vm (for triaxial vector magnitude). 
int_cuts 
Numeric vector with four cutpoints from which five intensity
ranges are derived. For example, 
cpm_nci 
Logical value for whether to calculate average counts per
minute by dividing average daily counts by average daily wear time, as
opposed to taking the average of each day's counts per minute value. Strongly
recommend leave as 
days_distinct 
Logical value for whether to treat each day of data as distinct, as opposed to analyzing the entire monitoring period as one continuous segment. 
nonwear_axis 
Character string specifying which axis should be used to classify nonwear time. Choices are "vert", "ap", "ml", "sum" (for triaxial sum), and "vm" (for triaxial vector magnitude). 
nonwear_window 
Integer value specifying minimum length of a nonwear period. 
nonwear_tol 
Integer value specifying tolerance for nonwear algorithm, i.e. number of minutes with nonzero counts allowed during a nonwear interval. 
nonwear_tol_upper 
Integer value specifying maximum count value for a minute with nonzero counts during a nonwear interval. 
nonwear_nci 
Logical value for whether to use nonwear algorithm from NCI's SAS programs. 
weartime_minimum 
Integer value specifying minimum number of wear time minutes for a day to be considered valid. 
weartime_maximum 
Integer value specifying maximum number of wear time minutes for a day to be considered valid. The default is 1440, but you may want to use a lower value (e.g. 1200) if participants were instructed to remove devices for sleeping, but often did not. 
active_bout_length 
Integer value specifying minimum length of an active bout. 
active_bout_tol 
Integer value specifying number of minutes with counts
outside the required range to allow during an active bout. If nonzero and

mvpa_bout_tol_lower 
Integer value specifying lower cutoff for count values outside of required intensity range for an MVPA bout. 
vig_bout_tol_lower 
Integer value specifying lower cutoff for count values outside of required intensity range for a vigorous bout. 
active_bout_nci 
Logical value for whether to use algorithm from the NCI's SAS programs for classifying active bouts. 
sed_bout_tol 
Integer value specifying number of minutes with counts outside sedentary range to allow during a sedentary bout. 
sed_bout_tol_maximum 
Integer value specifying upper cutoff for count values outside sedentary range during a sedentary bout. 
artifact_axis 
Character string specifying which axis should be used to identify artifacts (impossibly high count values). Choices are "vert", "ap", "ml", "sum" (for triaxial sum), and "vm" (for triaxial vector magnitude). 
artifact_thresh 
Integer value specifying the smallest count value that should be considered an artifact. 
artifact_action 
Integer value controlling method of correcting artifacts. Choices are 1 to exclude days with one or more artifacts, 2 to lump artifacts into nonwear time, 3 to replace artifacts with the average of neighboring count values, and 4 to take no action. 
weekday_weekend 
Logical value for whether to calculate averages for weekdays and weekend days separately (in addition to all valid days). 
return_form 
Character string controlling how variables are returned. Choices are "daily" for perday summaries, "averages" for averages across all valid days, and "both" for a list containing both. 
Value
Numeric matrix or list of two numeric matrices, depending on
return_form
.
References
National Cancer Institute. Risk factor monitoring and methods: SAS programs for analyzing NHANES 20032004 accelerometer data. Available at: http://riskfactor.cancer.gov/tools/nhanes_pam. Accessed Aug. 19, 2018.
Examples
# Note that the 'tridata' dataset contains 7 days of fake triaxial
# accelerometer data
# Process data using default parameters and request perday variables
accel.days < process_tri(
counts = tridata,
return_form = "daily"
)
# Repeat, but request averages across all valid days
accel.averages < process_tri(
counts = tridata,
return_form = "averages"
)
# Create perday summary again, but with many more variables
accel.days2 < process_tri(
counts = tridata,
brevity = 2,
return_form = "daily"
)
names(accel.days2)