# Convert volume
convert_val(10, "ml", "L")
convert_val(10:15, "ml", "L")
# Convert temperature
convert_val(-273.15, "C", "K")
convert_val(-40, "C", "F")
convert_val(c(2,4,6,8), "C", "F")
# Convert pressure
convert_val(1, "atm", "bar")
convert_val(1010, "hpa", "bar")
convert_val(735, "torr", "kpa")
# Convert area
convert_val(100, "cm2", "m2")
convert_val(10000, "mm2", "cm2")
# Convert mass
convert_val(200, "g", "kg")
convert_val(10000, "ug", "mg")
# Use directly in a respR function which requires inputs to be
# in a specific unit. For example, in convert_rate() pressure
# must be in 'bar' and respirometer volume in 'L'.
# Here, we know chamber volume is 200 ml, and pressure measured in mbar.
x <- suppressWarnings(inspect(urchins.rd, 1, 2))
rate <- calc_rate(x, from = 20, to = 30)
convert_rate(rate,
oxy.unit = "ml/l",
time.unit = "min",
output.unit = "mg/h",
volume = convert_val(200, "ml", "L"),
S = 35,
t = 15,
P = convert_val(1010, "mbar", "bar"))
# Note, the default 'to' units are set to those respR requires in
# these functions ('L' and 'bar' here), so do not necessarily need
# to be specified:
convert_rate(rate,
oxy.unit = "ml/l",
time.unit = "min",
output.unit = "mg/h",
volume = convert_val(200, "ml"),
S = 35,
t = 15,
P = convert_val(1010, "mbar"))
Run the code above in your browser using DataLab