Learn R Programming

respirometry (version 1.2.1)

guess_when: Estimate when the O2 level will reach a defined level

Description

Estimates the time at which O2 will reach a defined level assuming a linear change in O2 over time.

Usage

guess_when(past_o2, past_time, goal_o2, plot = TRUE)

Arguments

past_o2

a numeric vector of at least two oxygen measurements previously during the trial.

past_time

a vector of timepoints corresponding to when past_o2 values were recorded. Can be a numeric vector for duration since trial began or a POSIX vector of time values.

goal_o2

a numeric vector or single value describing the O2 level of interest.

plot

logical. Do you want to see a plot to visualize this prediction?

Value

A prediction of the time when O2 will reach goal_o2. If past_time is numeric, then a numeric value(s) will be returned. If POSIX, then POSIX will be returned.

See Also

predict_pH, predict_nh3

Examples

Run this code
# NOT RUN {
guess_when(past_o2 = rnorm(n = 10, mean = 100:91), past_time = 1:10, goal_o2 = 75, plot = FALSE)
guess_when(past_o2 = rnorm(n = 10, mean = 100:91, sd = 5), past_time = 1:10, goal_o2 = 75)
# Viewing the plot can be helpful to see how trustworthy the prediction is
# when signal:noise is low.

# }

Run the code above in your browser using DataLab