Learn R Programming

accelerometry (version 2.2.5)

accel.sedbreaks: Sedentary Breaks Detection

Description

This function identifies sedentary breaks in minute-to-minute accelerometer data.

Usage

accel.sedbreaks(counts, weartime = NULL, thresh = 100, return.flags = FALSE, 
                skipchecks = FALSE)

Arguments

counts

Time series accelerometer counts vector.

weartime

Accelerometer wear time vector; must be same length as counts and consist of 1's and 0's (if specified).

thresh

Minimum count value that must be achieved to record a sedentary break.

return.flags

If TRUE, function returns vector of 0's and 1's in which 1's indicate minutes in which a sedentary break has occurred; if FALSE, function returns total number of sedentary breaks during monitoring period.

skipchecks

If TRUE, function skips error checking code and runs slightly faster.

Value

Either a single numeric value indicating the total number of sedentary breaks during the monitoring period, or a vector of same length as counts where 1's indicate minutes in which a sedentary break has occurred.

References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

accel.weartime, accel.process.uni, accel.process.tri

Examples

Run this code
# NOT RUN {
# Load in sample data frame
data(unidata)

# Get data from ID number 21005
id.part1 <- unidata[unidata[, "seqn"] == 21005, "seqn"]
counts.part1 <- unidata[unidata[, "seqn"] == 21005, "paxinten"]

# Identify periods of valid wear time
weartime.flag <- accel.weartime(counts = counts.part1)

# Count number of sedentary breaks (over full week)
num.sedbreaks <- accel.sedbreaks(counts = counts.part1, weartime = weartime.flag)

# Flag minutes that represent sedentary breaks
flag.sedbreaks <- accel.sedbreaks(counts = counts.part1, weartime = weartime.flag, 
                                  return.flags = TRUE)
# }

Run the code above in your browser using DataLab