This function uses simple linear regression to calculate the rate of change of oxygen over time for background corrections of the main data. The background data must be in the same time and oxygen units as the data to be corrected. Multiple columns of background oxygen measures, as long as the time data are identical between measurements.The function returns rates for all columns, and also calculates an average rate.

calc_rate.bg(x, time = NULL, oxygen = NULL, plot = TRUE)

Arguments

x

data frame, inspect or inspect_data object. This is the data to process.

time

integer. Defaults to NULL. This specifies the column number of the time data. If NULL, function assumes time data are in Column 1.

oxygen

integer vector. Defaults to NULL. This specifies the column number(s) of the oxygen data. Multiple columns of oxygen can be specified. If NULL, function assumes oxygen data are in all columns of the data frame except Column 1.

plot

logical. Defaults to TRUE. Will plot the results for visual inspection.

Value

A list object of class calc_bg.rate.

Details

If you need to subset the data to remove regions you don't want to use, see subset_data.

There are no units involved in calc_rate.bg(). 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("urchins.rd")
#> Warning: data set ‘urchins.rd’ not found
calc_rate.bg(urchins.rd, time = 1, oxygen = 18:19)
#> Error in calc_rate.bg(urchins.rd, time = 1, oxygen = 18:19): could not find function "calc_rate.bg"