auto_rate: Automatically determine rate of change in oxygen...

Description Usage Arguments Details Value Examples

View source: R/auto_rate.R

Description

auto_rate automatically performs a rolling regression on a data frame to determine the most linear, maximum, minimum, or interval rate of change in oxygen concentration over time. First, a rolling regression of specified width is performed on the entire dataset to obtain all possible values. The computations are then ranked (or, arranged), based on the "logic" argument, and the output is summarised.

Usage

1
2
auto_rate(df, width = NULL, by = "row", method = "linear",
  plot = TRUE, parallel = FALSE)

Arguments

df

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

width

numeric. Width of the rolling regression. Defaults to floor(0.2*length of data) if NULL. The length of data can either be time or row, as defined by the by argument. If a number is supplied and it is less than 1, the function automatically applies the equation floor(width * length of data. Otherwise it will simply use the number as the width.

by

string. "row" or "time". Defaults to "row". However, if the function detects an irregular time series, a warning will be issued to recommend changing this argument to "time". In most cases "row" is used by default as it is efficient. Switching to "time" causes the function to perform checks for irregular time at every iteration of the rolling regression, even if time is evenly spaced, which adds to computation time.

method

string. "linear", "max", "min" or "interval". Defaults to linear. Note that if "linear" is selected, the argument width will be set to default.

plot

logical. Defaults to TRUE. Plot the results.

parallel

logical. Defaults to TRUE. Should parallel processing be used?

Details

Units

There are no units of measurement involved in auto_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().

Ranking algorithms

At present, auto_rate() contains four ranking algorithms that can be called with the argument method:

Value

A list object of class auto_rate.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# most linear section of the entire data
auto_rate(flowthrough.rd, parallel = FALSE)

# LONG EXAMPLES
## Not run: 
# what is the lowest rate over a 10 minute (600s) period?
auto_rate(sardine.rd, method = "min", width = 600, by = "time", parallel = FALSE)
# what is the highest rate over a 10 minute (600s) period?
auto_rate(sardine.rd, method = "max", width = 600, by = "time", parallel = FALSE)

## End(Not run)

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