rmr_sliding: Calculate resting metabolic rate using a sliding window...

View source: R/rmr_sliding.R

rmr_slidingR Documentation

Calculate resting metabolic rate using a sliding window method

Description

Calculate resting metabolic rate using a sliding window method

Usage

rmr_sliding(
  vo2_values,
  vo2_timestamps,
  start_time,
  stop_time,
  window_size_minutes = 5
)

Arguments

vo2_values

numeric vector of oxygen consumption values

vo2_timestamps

timestamps corresponding to each element of vo2_values

start_time

the beginning time of the assessment period

stop_time

the ending time of the assessment period

window_size_minutes

the size of the sliding window, in minutes

Value

A data frame giving the oxygen consumption from the lowest window, as well as the time difference from first to last breath in the same window.

Examples

set.seed(144)
fake_start_time <- Sys.time()
fake_stop_time <- fake_start_time + 1800
fake_timestamps <- fake_start_time + cumsum(sample(1:3, 500, TRUE))
fake_timestamps <- fake_timestamps[fake_timestamps <= fake_stop_time]
fake_breaths <- rnorm(length(fake_timestamps), 450, 0.5)
window_size <- 5

rmr_sliding(
  fake_breaths, fake_timestamps,
  fake_start_time, fake_stop_time,
  window_size
)

PAutilities documentation built on Aug. 21, 2022, 9:05 a.m.