# Load in sample data from NHANES 2003-2004 [1]
data(unidata)
# Get data from ID number 21005
id.part1 <- unidata[unidata[,"seqn"] == 21005,"seqn"]
days.part1 <- unidata[unidata[,"seqn"] == 21005,"paxday"]
counts.part1 <- unidata[unidata[,"seqn"] == 21005,"paxinten"]
# Identify periods of valid wear time
weartime.flag <- accel.weartime(counts = counts.part1)
# Flag minutes that are part of a moderate-to-vigorous activity bout
mvpa.bouts.flag <- accel.bouts(counts = counts.part1, weartime = weartime.flag,
thresh.lower = 2020)
# Obtain maximum 10-minute count average
max.10min.movingave <- movingaves(x=counts.part1,window=10,return.max=TRUE)
# Process data from ID 21005 and request per-day variables and daily averages
accel.list <- accel.process.uni(counts = counts.part1, id = id.part1, return.form = 3)
# Process data according to methods used in NCI's SAS programs [2]
accel.nci <- accel.process.uni(counts = counts.part1, id = id.part1, brevity = 2,
valid.days = 4, cpm.nci = TRUE, days.distinct = TRUE,
nonwear.tol = 2, nonwear.tol.upper = 100,
nonwear.nci = TRUE, weartime.maximum = 1440,
active.bout.tol = 2, active.bout.nci = TRUE,
artifact.thresh = 32767, artifact.action = 3,
return.form = 3)
# Load in triaxial sample data
data(tridata)
# Process data and request per-day variables
accel.days <- accel.process.tri(counts = tridata[,1:3], steps = tridata[,4])
# Process data, but for non-wear detection use triaxial vector magnitude with 90-
# minute window and two-minute tolerance for nonzero counts up to 200
accel.days <- accel.process.tri(counts = tridata[,1:3], steps = tridata[,4],
nonwear.axis = "mag", nonwear.window = 90,
nonwear.tol = 2, nonwear.tol.upper = 200)Run the code above in your browser using DataLab