calc_rate calculates the rate of change in oxygen concentration over time in a data frame. You can perform single or multiple regressions on subsets of the data frame by calling the from and to arguments.

calc_rate(x, from = NULL, to = NULL, by = "time", plot = TRUE)

Arguments

x

data frame or object of class adjust_rate. This is the data to process.

from

numeric vector. Defaults to NULL. Defines the lower bound(s) of the data frame to subset. Subsetting is based on the argument: by.

to

numeric vector. Defaults to NULL. Defines the upper bound(s) of the data frame to subset. Subsetting is based on the argument: by.

by

string. "time", "row", "o2" or "proportion" Defaults to "time".This is the method used to subset the data.

plot

logical. Defaults to TRUE. Plot the results.

Value

A list object of class calc_rate.

Details

There are no units involved in calc_rate. This is a deliberate decision. Units are called in a later function when absolute and/or mass-specific rates of oxygen use are computed in convert_rate() and convert_DO().

Examples

data("sardine.rd")
#> Warning: data set ‘sardine.rd’ not found
calc_rate(sardine.rd, from = 200, to = 1800) # default subset by 'time'
#> Error in calc_rate(sardine.rd, from = 200, to = 1800): could not find function "calc_rate"
calc_rate(sardine.rd, 93, 92, by = 'o2') # subset by O2
#> Error in calc_rate(sardine.rd, 93, 92, by = "o2"): could not find function "calc_rate"
calc_rate(sardine.rd, 1, 1000, by = 'row') # subset by row
#> Error in calc_rate(sardine.rd, 1, 1000, by = "row"): could not find function "calc_rate"
x <- calc_rate(sardine.rd, .8, .2, by = 'proportion') # subset by proportion
#> Error in calc_rate(sardine.rd, 0.8, 0.2, by = "proportion"): could not find function "calc_rate"
x
#> Error in eval(expr, envir, enclos): object 'x' not found
#> Error in summary(x): object 'x' not found
plot(x)
#> Error in plot(x): object 'x' not found
# Using a vector in 'from' and 'to' perform multiple measurements: data("intermittent.rd")
#> Warning: data set ‘intermittent.rd’ not found
calc_rate(intermittent.rd, c(200,2300,4100), c(1800,3200,4600), by = 'time')
#> Error in calc_rate(intermittent.rd, c(200, 2300, 4100), c(1800, 3200, 4600), by = "time"): could not find function "calc_rate"