dataCollapser function

Collapse Accelerometer Data to a Dataset with a Longer Epoch

Collapse Accelerometer Data to a Dataset with a Longer Epoch

The function collapses counts in data collected with a short epoch to make a data set with a longer epoch. For example, this function collapses data with 1-sec epoch to 10-sec epoch or 1-min epoch data.

dataCollapser(dataset, TS, by, col, func = sum, ...)

Arguments

  • dataset: The source dataset, in dataframe format, that needs to be collapsed.
  • TS: The column name for timestamp.
  • by: Epoch in seconds for a collapsed dataset. For example, to collapse second data to minute data, set by = 60; to collapse 10-second data to minute data, set by = 60.
  • col: The column name(s) to collapse. If not provided, will default to all numeric columns.
  • func: A method for collapsing counts. The default is the summation of counts.
  • ...: Argument settings that to be used by user-defined "func" setting.

Returns

A collapsed data with user specified epoch.

Examples

data(dataSec) ## collapse 1-sec epoch data to 10-sec epoch data mydata10s = dataCollapser(dataSec, TS = "TimeStamp", col = "counts", by = 10) ## collapse 1-sec epoch data to 1-min epoch data mydata1m = dataCollapser(dataSec, TS = "TimeStamp", col = "counts", by = 60)

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.

Author(s)

Zhouwen Liu zhouwen.liu@vumc.org

  • Maintainer: Leena Choi
  • License: GPL (>= 3)
  • Last published: 2021-01-22

Useful links