readCountsData: Convert Accelerometer Output Data to a Correct Data Format

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/readCountsData.R

Description

This function converts accelerometer output data to a correct data format to classify wear and nonwear time using wearingMarking. This function can accept accelerometer output data with various epochs (for example, 1-sec, 10-sec or 1-min). If accelerometer data are collected with three axes, it creates vector magnitude (vm).

Usage

1
readCountsData(filename, ctPerSec, mode = 0)

Arguments

filename

A filename of accelerometer output to be read.

ctPerSec

Data collection epoch. This argument tells the program the number of counting will be performed in every second. For examples: for 1-sec epoch data, set ctPerSec = 1; for 10-sec epoch data, set ctPerSec = 1/10; for 1-min epoch data, set ctPerSec = 1/60.

mode

The mode of the ActiLife dat file. Defaults to 0, and should be listed in the file header.

Value

a data frame with the correct format (TimeStamp, counts) to be used for wearingMarking.

Note

Warning: It can be very slow if accelerometer data were collected with 1-sec epoch for many days.

Author(s)

Zhouwen Liu zhouwen.liu@vumc.org

References

Choi L, Liu Z, Matthews CE, Buchowski MS. Validation of accelerometer wear and nonwear time classification algorithm. Med Sci Sports Exerc. 2011 Feb;43(2):357-64.

See Also

wearingMarking

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
###############################################################################
## Read accelerometer output and convert to a correct format (TimeStamp, counts)
## Suppose "rawActigraphOutput.dat" is an Actigraph output with header as follows:
###############################################################################
## --- Data File Created By ActiGraph GT1M ActiLife v4.4.1 Firmware v7.2.0 ---
## Serial Number: LYN2B21080027
## Start Time 16:15:00
## Start Date 6/16/2010
## Epoch Period (hh:mm:ss) 00:00:01
## Download Time 09:50:23
## Download Date 6/22/2010
## Current Memory Address: 983038
## Current Battery Voltage: 4.01     Mode = 0
## --------------------------------------------------
###############################################################################
## This raw data with 1-sec epoch can be converted to a correct data format to
## classify wear and nonwear time using "wearingMarking" by the following code:

## Not run: mydata1s = readCountsData("rawActigraphOutput.dat", ctPerSec=1)

PhysicalActivity documentation built on Jan. 23, 2021, 1:06 a.m.