This function performs either a bin- or a rolling-average on the interpolated data.
You must specify the type
of the average before continuing.
Usage
perform_average(
.data,
type = c("bin", "rolling", "ensemble"),
bins = 30,
rolling_window = 30
)
Arguments
- .data
The second-by-second data retrieved from
interpolate()
.- type
The type of the average to perform. Either
bin
,rolling
, orensemble
.- bins
If bin-average is chosen, here you can specify the size of the bin-average, in seconds. Default to 30-s bin-average.
- rolling_window
If rolling-average is chosen, here you can specify the rolling-average window, in seconds. Default to 30-s rolling-average.
Value
a tibble
Details
Ensemble average is used in VO2 kinetics analysis, where a series of transitions from baseline to the moderate/heavy/severe intensity-domain is ensembled averaged into a single 'bout' for further data processing.
Examples
if (FALSE) { # \dontrun{
## get file path from example data
path_example <- system.file("example_cosmed.xlsx", package = "whippr")
## read data
df <- read_data(path = path_example, metabolic_cart = "cosmed")
## interpolate and perform 30-s bin-average
df %>%
interpolate() %>%
perform_average(type = "bin", bins = 30)
## interpolate and perform 30-s rolling-average
df %>%
interpolate() %>%
perform_average(type = "rolling", rolling_window = 30)
} # }