Skip to contents

It performs the whole process of the VO2max data analysis, which includes: data standardization and normalization according to incremental protocol (incremental_normalize()), 'bad breaths' detection (detect_outliers()), mean response time calculation (incremental_mrt()) (currently ignored), and maximal values calculation (VO2, PO, HR, RER) (perform_max()).

Usage

vo2_max(
  .data,
  vo2_column = "VO2",
  vo2_relative_column = NULL,
  heart_rate_column = NULL,
  rer_column = NULL,
  detect_outliers = TRUE,
  average_method = c("bin", "rolling"),
  average_length = 30,
  mrt,
  plot = TRUE,
  verbose = TRUE,
  ...
)

Arguments

.data

Data retrieved from read_data().

vo2_column

The name (quoted) of the column containing the absolute oxygen uptake (VO2) data. Default to "VO2".

vo2_relative_column

The name (quoted) of the column containing the relative to body weight oxygen uptake (VO2) data. Default to NULL.

heart_rate_column

The name (quoted) of the column containing the heart rate (HR) data. Default to NULL. If NULL, this parameter will not be calculated.

rer_column

The name (quoted) of the column containing the respiratory exchange ratio (RER) data. Default to NULL. If NULL, this parameter will not be calculated.

detect_outliers

A boolean indicating whether to detect outliers. Default to TRUE.

average_method

The average method to be used for VO2max calculation. One of bin or rolling.

average_length

The length, in seconds, of the average to be used. For example, if average_method = bin, and average_length = 30, it will perform a 30-s bin-average.

mrt

A boolean indicating whether to calculate the mean response time. To be implemented soon <- currently ignored.

plot

A boolean indicating whether to produce a plot with the summary results. Default to TRUE.

verbose

A boolean indicating whether messages should be printed in the console. Default to TRUE.

...

Additional arguments passed onto incremental_normalize(), detect_outliers() if detect_outliers = TRUE, and incremental_mrt() if mrt = TRUE.

Value

a tibble containing one row and the following columns:

VO2max_absolute

The absolute VO2max.

VO2max_relative

The relative VO2max.

POpeak

The peak power output.

HRmax

The maximal heart rate.

RERmax

The maximal RER.

plot

The plot, if plot = TRUE.

Details

TODO

Examples

if (FALSE) {
## get file path from example data
path_example <- system.file("ramp_cosmed.xlsx", package = "whippr")

## read data from ramp test
df <- read_data(path = path_example, metabolic_cart = "cosmed")

## normalize incremental test data
ramp_normalized <- df %>%
 incremental_normalize(
   .data = .,
   incremental_type = "ramp",
   has_baseline = TRUE,
   baseline_length = 240,
   work_rate_magic = TRUE,
   baseline_intensity = 20,
   ramp_increase = 25
 )

## detect outliers
data_ramp_outliers <- detect_outliers(
 .data = ramp_normalized,
 test_type = "incremental",
 vo2_column = "VO2",
 cleaning_level = 0.95,
 method_incremental = "linear",
 verbose = TRUE
)

## analyze VO2max
perform_max(
 .data = data_ramp_outliers,
 vo2_column = "VO2",
 vo2_relative_column = "VO2/Kg",
 heart_rate_column = "HR",
 rer_column = "R",
 average_method = "bin",
 average_length = 30,
 plot = TRUE,
 verbose = FALSE
)
}