calc_rate: Calculate rate of change in oxygen over time

Description Usage Arguments Details Value Examples

View source: R/calc_rate.R

Description

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.

Usage

1
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.

Details

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

Value

A list object of class calc_rate.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
calc_rate(sardine.rd, from = 200, to = 1800)     # default subset by 'time'
calc_rate(sardine.rd, 93, 92, by = 'o2')         # subset by O2
calc_rate(sardine.rd, 1, 1000, by = 'row')     # subset by row
x <- calc_rate(sardine.rd, .8, .2, by = 'proportion') # subset by proportion
x
summary(x)
plot(x)

# Using a vector in 'from' and 'to' perform multiple measurements:
data(intermittent.rd)
calc_rate(intermittent.rd, c(200,2300,4100), c(1800,3200,4600), by = 'time')

januarharianto/respR documentation built on Nov. 13, 2018, 1:21 p.m.