convert_rate: Convert rate value to volumetric and/or mass-specific

Description Usage Arguments Details Value Examples

View source: R/convert_rate.R

Description

This is a conversion function. It can convert a dimensionless unit of rate, derived from calc_rate, calc_rate.ft, auto_rate, or adjust_rate into volume-adjusted (i.e. to the container), VO2 or mass-specific (i.e. to the specimen mass), MO2 rate.

Usage

1
2
convert_rate(x, o2.unit = NULL, time.unit = NULL, output.unit = NULL,
  volume = NULL, mass = NULL, S = NULL, t = NULL, P = NULL)

Arguments

x

numeric, or objects of class calc_rate(), calc_rate.ft(), auto_rate() or adjust_rate().

o2.unit

string. The dissolved oxygen unit of the data used to determine rate. Check unit_args().

time.unit

string. The time unit of the data used to determine rate. Check unit_args().

output.unit

string. The output unit to convert rate to. Check unit_args().

volume

numeric. Volume in litres. This is the volume of fluid in the respirometry chamber, not the specimen volume.

mass

numeric. Mass/weight in kg. This is the mass of the specimen if you wish to calculate mass-specific rates.

S

numeric. Salinity (ppt). Defaults to NULL. Used only in conversion of some units. See unit_args() for details.

t

numeric. Temperature(°C). Defaults to NULL. Used only in conversion of some units. See unit_args() for details.

P

numeric. Pressure (bar). Defaults to NULL. Used only in conversion of some units. If left NULL, default value of 1.013253 is applied in conversions. See unit_args() for details.

Details

The function uses an internal database and a fuzzy string matching algorithm to accept various unit formatting styles.

For example, 'mg/l', 'mg/L', 'mgL-1', 'mg l-1', 'mg.l-1' are all the same. Use unit_args() to view a list of usable unit strings.

Output units (output.unit) must be in the sequence O2-Time (e.g. mg/h, mg-h) for volumetric rates, and for mass-specific rates O2-Time-Mass (e.g. mg/h/kg).

Some units also require temperature (t), salinity (S), and atmospheric pressure (P) to be specified. See unit_args() for details. For freshwater experiments, salinity should be set to zero (i.e. S = 0).

Value

A list object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Manually enter values
convert_rate(7.5, o2.unit = 'mg/l', time.unit = 's',
  output.unit = 'mg/min/kg', volume = 1.2, mass = 0.5)

# Use example data
data(sardine.rd)
x <- calc_rate(sardine.rd, from = 200, to = 1800, by = "time")
convert_rate(x, o2.unit = '%', time.unit = 's',
  output.unit = 'mg/h/g', volume = 12.3, mass = 0.05,
  S =35, t = 15, P = 1.013)

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