This function performs either a bin- or a rolling-average on the interpolated data. You must specify the type of the average before continuing.

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, or ensemble.

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

## 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)
#> # Metabolic cart: COSMED #> # Data status: averaged data - 30-s bins #> # Time column: t #> # A tibble: 73 x 114 #> t Rf VT VE VO2 VCO2 O2exp CO2exp `VE/VO2` `VE/VCO2` `VO2/Kg` #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0 19.0 1.33 24.0 932. 744. 207. 58.9 25.8 32.5 11.2 #> 2 30 15.3 1.85 27.1 1097. 904. 284. 87.0 24.8 30.1 13.2 #> 3 60 19.6 1.47 27.1 1133. 892. 223. 69.6 24.1 30.7 13.7 #> 4 90 13.3 2.29 26.0 1043. 885. 353. 111. 24.9 29.5 12.6 #> 5 120 20.5 1.43 27.1 1107. 883. 218. 66.9 24.6 31.0 13.3 #> 6 150 14.4 1.57 22.1 928. 751. 239. 75.5 24.1 29.7 11.2 #> 7 180 23.0 1.18 26.4 1071. 849. 180. 54.4 24.8 31.3 12.9 #> 8 210 16.1 2.17 28.7 1070. 941. 342. 101. 27.0 30.6 12.9 #> 9 240 18.9 1.43 26.1 1058. 880. 219. 68.8 24.7 29.8 12.7 #> 10 270 15.1 1.65 24.5 987. 847. 253. 81.4 24.8 28.9 11.9 #> # … with 63 more rows, and 103 more variables: R <dbl>, FeO2 <dbl>, #> # FeCO2 <dbl>, HR <dbl>, `VO2/HR` <dbl>, Load1 <dbl>, Load2 <dbl>, #> # Load3 <dbl>, Phase <dbl>, FetO2 <dbl>, FetCO2 <dbl>, FiO2 <dbl>, #> # FiCO2 <dbl>, Ti <dbl>, Te <dbl>, Ttot <dbl>, `Ti/Ttot` <dbl>, IV <dbl>, #> # PetO2 <dbl>, PetCO2 <dbl>, `P(a-et)CO2` <dbl>, SpO2 <dbl>, #> # `VD(phys)` <dbl>, `VD/VT` <dbl>, `Env. Temp.` <dbl>, `Analyz. Temp.` <dbl>, #> # `Analyz. Press.` <dbl>, `Env. Press.` <dbl>, Batteries <dbl>, PaCO2 <dbl>, #> # PaO2 <dbl>, PH <dbl>, SaO2 <dbl>, `HCO3-` <dbl>, `Bias Flow` <dbl>, #> # `La-` <dbl>, Hb <dbl>, EEm <dbl>, EEh <dbl>, EEkc <dbl>, EEbsa <dbl>, #> # EEkg <dbl>, PROg <dbl>, PROkc <dbl>, FATg <dbl>, FATkc <dbl>, CHOg <dbl>, #> # CHOkc <dbl>, `PRO%` <dbl>, `FAT%` <dbl>, `CHO%` <dbl>, npRQ <dbl>, `t #> # Rel` <dbl>, `mark Speed` <dbl>, `mark Dist.` <dbl>, `ST I` <dbl>, `ST #> # II` <dbl>, `ST III` <dbl>, `ST aVR` <dbl>, `ST aVL` <dbl>, `ST aVF` <dbl>, #> # `ST V1` <dbl>, `ST V2` <dbl>, `ST V3` <dbl>, `ST V4` <dbl>, `ST V5` <dbl>, #> # `ST V6` <dbl>, `S I` <dbl>, `S II` <dbl>, `S III` <dbl>, `S aVR` <dbl>, `S #> # aVL` <dbl>, `S aVF` <dbl>, `S V1` <dbl>, `S V2` <dbl>, `S V3` <dbl>, `S #> # V4` <dbl>, `S V5` <dbl>, `S V6` <dbl>, `P Syst` <dbl>, `P Diast` <dbl>, #> # Symptom <dbl>, DP <dbl>, Stage <dbl>, RR <dbl>, METS <dbl>, Qt <dbl>, #> # SV <dbl>, `Vt/FVC` <dbl>, Alt <dbl>, `GPS Speed` <dbl>, `GPS Dist.` <dbl>, #> # predVO2 <dbl>, BR <dbl>, `O2 Cost` <dbl>, EEtot <dbl>, IC <dbl>, #> # Step <dbl>, LogVE <dbl>, `P(A-a)O2` <dbl>, …
## interpolate and perform 30-s rolling-average df %>% interpolate() %>% perform_average(type = "rolling", rolling_window = 30)
#> # Metabolic cart: COSMED #> # Data status: averaged data - 30-s rolling average #> # Time column: t #> # A tibble: 2,130 x 114 #> t Rf VT VE VO2 VCO2 O2exp CO2exp `VE/VO2` `VE/VCO2` `VO2/Kg` #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 16.5 16.4 1.75 26.5 1033. 852. 271. 80.1 25.7 31.3 12.4 #> 2 17.5 16.6 1.76 27.0 1054. 870. 273. 80.7 25.7 31.3 12.7 #> 3 18.5 16.7 1.78 27.3 1067. 882. 276. 81.6 25.7 31.3 12.9 #> 4 19.5 16.4 1.80 27.4 1071. 887. 280. 82.8 25.7 31.2 12.9 #> 5 20.5 16.2 1.82 27.4 1071. 888. 282. 83.6 25.7 31.1 12.9 #> 6 21.5 16.0 1.82 27.3 1068. 885. 282. 83.8 25.7 31.1 12.9 #> 7 22.5 16.0 1.81 27.1 1062. 880. 280. 83.4 25.7 31.1 12.8 #> 8 23.5 16.0 1.78 26.9 1052. 871. 277. 82.4 25.6 31.0 12.7 #> 9 24.5 16.1 1.77 26.7 1048. 867. 274. 81.8 25.5 31.0 12.6 #> 10 25.5 16.1 1.76 26.6 1050. 868. 273. 81.9 25.4 30.8 12.6 #> # … with 2,120 more rows, and 103 more variables: R <dbl>, FeO2 <dbl>, #> # FeCO2 <dbl>, HR <dbl>, `VO2/HR` <dbl>, Load1 <dbl>, Load2 <dbl>, #> # Load3 <dbl>, Phase <dbl>, FetO2 <dbl>, FetCO2 <dbl>, FiO2 <dbl>, #> # FiCO2 <dbl>, Ti <dbl>, Te <dbl>, Ttot <dbl>, `Ti/Ttot` <dbl>, IV <dbl>, #> # PetO2 <dbl>, PetCO2 <dbl>, `P(a-et)CO2` <dbl>, SpO2 <dbl>, #> # `VD(phys)` <dbl>, `VD/VT` <dbl>, `Env. Temp.` <dbl>, `Analyz. Temp.` <dbl>, #> # `Analyz. Press.` <dbl>, `Env. Press.` <dbl>, Batteries <dbl>, PaCO2 <dbl>, #> # PaO2 <dbl>, PH <dbl>, SaO2 <dbl>, `HCO3-` <dbl>, `Bias Flow` <dbl>, #> # `La-` <dbl>, Hb <dbl>, EEm <dbl>, EEh <dbl>, EEkc <dbl>, EEbsa <dbl>, #> # EEkg <dbl>, PROg <dbl>, PROkc <dbl>, FATg <dbl>, FATkc <dbl>, CHOg <dbl>, #> # CHOkc <dbl>, `PRO%` <dbl>, `FAT%` <dbl>, `CHO%` <dbl>, npRQ <dbl>, `t #> # Rel` <dbl>, `mark Speed` <dbl>, `mark Dist.` <dbl>, `ST I` <dbl>, `ST #> # II` <dbl>, `ST III` <dbl>, `ST aVR` <dbl>, `ST aVL` <dbl>, `ST aVF` <dbl>, #> # `ST V1` <dbl>, `ST V2` <dbl>, `ST V3` <dbl>, `ST V4` <dbl>, `ST V5` <dbl>, #> # `ST V6` <dbl>, `S I` <dbl>, `S II` <dbl>, `S III` <dbl>, `S aVR` <dbl>, `S #> # aVL` <dbl>, `S aVF` <dbl>, `S V1` <dbl>, `S V2` <dbl>, `S V3` <dbl>, `S #> # V4` <dbl>, `S V5` <dbl>, `S V6` <dbl>, `P Syst` <dbl>, `P Diast` <dbl>, #> # Symptom <dbl>, DP <dbl>, Stage <dbl>, RR <dbl>, METS <dbl>, Qt <dbl>, #> # SV <dbl>, `Vt/FVC` <dbl>, Alt <dbl>, `GPS Speed` <dbl>, `GPS Dist.` <dbl>, #> # predVO2 <dbl>, BR <dbl>, `O2 Cost` <dbl>, EEtot <dbl>, IC <dbl>, #> # Step <dbl>, LogVE <dbl>, `P(A-a)O2` <dbl>, …