computeActivityIndex {ActivityIndex} | R Documentation |
Compute Activity Index
Description
computeActivityIndex
computes the Activity Index using raw
accelerometry data, based on user specified parameters such as sample rate
and epoch length.
Usage
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)
## Default S3 method:
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)
## S3 method for class 'GT3XPlus'
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)
Arguments
x |
An object containing raw accelerometry data, which could
either be a 4-column data frame or " |
x_sigma0 |
A 4-column data frame containing the raw accelerometry
data when the device is not worn. The 1st column has the record/index
number. The 2nd to 4th columns contain the tri-axial raw acceleration. The
data will be used to calculate |
sigma0 |
Specify |
epoch |
The epoch length (in second) of the Activity Index. Must be a positive integer. |
hertz |
The sample rate of the data. |
Details
x
could be either of the following two types of objects:
A 4-column data frame containing the tri-axial raw accelerometry data in the 2nd to 4th column, and the associated record number (could be time) in the 1st column.
ReadTable
can be used to generate such data frame.An "
GT3XPlus
" object given by functionReadGT3XPlus
.
Value
A data frame with two columns. The first column has the "record number" associated with each entry of Activity Index, while the second column has the actual value of Activity Index.
Examples
library(graphics)
fname = system.file("extdata", "sample_table.csv.gz",
package = "ActivityIndex")
sampleTable = ReadTable(fname)
AI_sampleTable_x = computeActivityIndex(
sampleTable,
x_sigma0 = sampleTable[1004700:1005600, ],
epoch = 1,
hertz = 30)
AI_sampleTable_x
plot(AI ~ RecordNo, data = AI_sampleTable_x, type = "l")