add_hr {spiro}R Documentation

Import and add heart rate data to cardiopulmonary exercise testing data

Description

add_hr() imports an external file containing heart rate data and adds it to an existing gas exchange data file.

Usage

add_hr(data, hr_file, hr_offset = 0)

Arguments

data

A data.frame of the class spiro containing the gas exchange data. Usually the output of a spiro call.

hr_file

The absolute or relative path of a *tcx file that contains additional heart rate data.

hr_offset

An integer, corresponding to the temporal offset of the heart-rate file. By default the start of the heart rate measurement is linked to the start of the gas exchange measurement. A positive value means, that the heart rate measurement started after the begin of the gas exchange measurements; a negative value means it started before.

Details

Heart rate data will be imported from a .tcx file. After interpolating the data to full seconds, it is then matched to the imported gas exchange data.

Value

A data.frame of the class spiro containing the cardiopulmonary exercise testing data including heart rate data.

Examples

# Get example data
oxy_file <- spiro_example("zan_ramp")
hr_file <- spiro_example("hr_ramp.tcx")

# Import and process spiro data
oxy_data <- spiro(oxy_file)

# Add heart rate data
out <- add_hr(oxy_data, hr_file)
head(out)

[Package spiro version 0.2.1 Index]