MR.loops {rMR} | R Documentation |
Calculate Metabolic Rates from Multiple Closed Respirometry Loops
Description
This function calculates the metabolic rates from multiple closed respirometry loops simultaneously. Requires lots of user input, but is easy to manipulate. Returns list of metabolic rates, as well as the average metabolic rate and the standard deviation of the sample of metabolic rates, as well as biglm objects for each section of data used to calculate MRs.
Usage
MR.loops(data, DO.var.name, time.var.name = "std.time",
in.DO.meas = "mg/L", out.DO.meas = "mg/L",
start.idx, stop.idx, syst.vol = 1,
background.consumption = 0,
background.indices = NULL,
temp.C, elevation.m = NULL,
bar.press = NULL, bar.units = "atm",
PP.units, time.units = "sec",
col.vec = c("black","red"),...)
Arguments
data |
Must include a time variable in standard |
DO.var.name |
Column name of DO variable, must be entered as character string. |
time.var.name |
Column name of time variable (which is in |
in.DO.meas |
Units of DO measurement entered in the DO variable column: must be one of |
out.DO.meas |
Units of DO measurement returned for metabolic rate: must be one of |
start.idx |
Character class value or vector matching |
stop.idx |
Character class value or vector matching |
syst.vol |
System volume in Liters (defaults to 1 L). |
background.consumption |
Default = 0. If using a one point calibration for background, simply set |
background.indices |
If using a multi-point calibration to set the background respiration rate, enter a vector of times for when the respiration rates were calculated. There should be one time point per corresponding value in |
temp.C |
Water temperature in degrees C. |
elevation.m |
Elevation in m. Only required if |
bar.press |
barometric pressure in units defined by bar.units argument. Only required if |
bar.units |
Units of barometric pressure used as input and in output if |
PP.units |
Units of barometric pressure used for "PP". |
time.units |
Denominator for metabolic rate, also displayed as units on X-axis. Acceptable arguments: "hr", "min", "sec". |
col.vec |
Specifies colors on plot in the following order: 1) scatterplot points, 2) regression lines color. |
... |
Arguments passed on to internal functions |
Value
Returns a list of 2. $MR.summary
is of class data.frame with 3 columns: $MR
(metabolic rate in user specified units, this is the same as the slope in each linear model), $sd.slope
(standard deviation of slopes calculation), $r.square
(adjusted r square value from each model). This second object is a list of biglm
objects, each one representing a metabolic loop (see McDonnell and Chapman 2016).
Author(s)
Tyler L. Moulton
References
McDonnell, Laura H., and Lauren J. Chapman (2016). "Effects of thermal increase on aerobic capacity and swim performance in a tropical inland fish." Comparative Biochemistry and Physiology Part A: Molecular & Integrative Physiology 199: 62-70. doi: 10.1016/j.cbpa.2016.05.018.
Roche, Dominique G., et al. (2013). "Finding the best estimates of metabolic rates in a coral reef fish." Journal of Experimental Biology 216.11: 2103-2110. doi: 10.1242/jeb.082925.
See Also
as.POSIXct
,
strptime
,
background.resp
,
Barom.Press
,
Eq.Ox.conc
,
biglm
,
Examples
## load data ##
data(fishMR)
## create time variable in POSIXct format ##
fishMR$std.time <- as.POSIXct(fishMR$Date.time,
format = "%d/%m/%Y %I:%M:%S %p")
## calc background resp rate
bgd.resp <-
background.resp(fishMR, "DO.mgL",
start.time = "2015-07-02 16:05:00",
end.time = "2015-07-02 16:35:00",
ylab = "DO (mg/L)", xlab = "time (min)")
bg.slope.a <- bgd.resp$mat[2]
starts <- c("2015-07-03 01:15:00", "2015-07-03 02:13:00",
"2015-07-03 03:02:00", "2015-07-03 03:50:00",
"2015-07-03 04:50:00")
stops <- c("2015-07-03 01:44:00", "2015-07-03 02:35:30",
"2015-07-03 03:25:00", "2015-07-03 04:16:00",
"2015-07-03 05:12:00")
metR <- MR.loops(data = fishMR, DO.var.name ="DO.mgL",
start.idx = starts, time.units = "hr",
stop.idx = stops, time.var.name = "std.time",
temp.C = "temp.C", elevation.m = 1180,
bar.press = NULL, in.DO.meas = "mg/L",
background.consumption = bg.slope.a,
ylim=c(6, 8))
metR$MR.summary
## now lets assume we ran a control loop for background rate
## before and after we ran the MR loops
## let:
bg.slope.b <-bg.slope.a -0.0001
metRa <- MR.loops(data = fishMR, DO.var.name ="DO.mgL",
start.idx = starts, time.units = "hr",
stop.idx = stops, time.var.name = "std.time",
temp.C = "temp.C", elevation.m = 1180,
bar.press = NULL, in.DO.meas = "mg/L",
background.consumption = c(bg.slope.a, bg.slope.b),
background.indices = c("2015-07-02 16:20:00",
"2015-07-03 06:00:00"),
ylim=c(6, 8))
metRa$MR.summary
# note that the calculated slopes
# diverge as time increases. This is
# because the background respiration
# rate is increasing.
metR$MR.summary-metRa$MR.summary
## This looks great, but you need to check your start and
## stop vectors, otherwise, you could end up with some
## atrocious loops, e.g.:
starts <- c("2015-07-03 01:15:00", "2015-07-03 02:13:00",
"2015-07-03 03:02:00", "2015-07-03 03:50:00",
"2015-07-03 04:50:00")
stops <- c("2015-07-03 01:50:00", "2015-07-03 02:35:30",
"2015-07-03 03:25:00", "2015-07-03 04:16:00",
"2015-07-03 05:12:00")
metRb <- MR.loops(data = fishMR, DO.var.name ="DO.mgL",
start.idx = starts,
stop.idx = stops, time.var.name = "std.time",
temp.C = "temp.C", elevation.m = 1180,
bar.press = NULL, in.DO.meas = "mg/L",
background.consumption = bg.slope.a,
ylim=c(6,8))