Description Usage Arguments Value Author(s) References Examples
View source: R/dataCollapser.R
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.
1 | dataCollapser(dataset, TS, by, col, func = sum, ...)
|
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. |
A collapsed data with user specified epoch.
Zhouwen Liu zhouwen.liu@vumc.org
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.
1 2 3 4 5 6 7 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.