Title: | Allometric Equations for Southern Ocean Taxa |
---|---|
Description: | Provides allometric equations that relate the body size of Southern Ocean taxa to body part measurements. |
Authors: | Ben Raymond [aut, cre], Anton Van de Putte [ctb], Martin Cox [ctb] |
Maintainer: | Ben Raymond <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2024-11-02 02:56:33 UTC |
Source: | https://github.com/SCAR/solong |
A dataset containing allometric equations (relationships between the size of an organism and the size of its body parts).
allometric_equations
allometric_equations
A data frame with variables:
the identifier of this equation
name of the taxon
the Aphia ID of the taxon (identifier within the World Register of Marine Species)
a function encoding the allometric equation
a data.frame specifying (in order) the inputs to the equation, with columns 'property' (the property name of the measurement needed, e.g. 'lower rostral length'), and 'units' (the units of the measurement needed, e.g. 'mm')
the name of the body size characteristic that is estimated by this equation (e.g. 'mantle length')
the units of measurement of the returned property
a data.frame with indicators of the reliability of the equation: type (a description of how the reliability was assessed, e.g. 'R^2' or 'N' the sample size used by the authors of the equation) and value (its value)
notes
the source of the equation
Apply allometric equations
sol_allometry(data, equation)
sol_allometry(data, equation)
data |
data.frame: input data |
equation |
character or sol_equation object: either the identifier of the equation to apply, or the equation object itself. Can be a single element (this equation will be applied to all rows of the data) or with length matching the number of rows of the data |
the input data frame, augmented with columns "allometric_property", "allometric_value", "allometric_value_lower", and "allometric_value_upper"
## Not run: x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) ## it doesn't matter what the column names are, but we ## need to set the property types correctly x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## apply a single equation to all rows sol_allometry(x,c("342218_ML_Roel2000")) ## apply a different equation to each row sol_allometry(x,c("342218_ML_Roel2000","342218_ML_Clar1986")) ## End(Not run)
## Not run: x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) ## it doesn't matter what the column names are, but we ## need to set the property types correctly x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## apply a single equation to all rows sol_allometry(x,c("342218_ML_Roel2000")) ## apply a different equation to each row sol_allometry(x,c("342218_ML_Roel2000","342218_ML_Clar1986")) ## End(Not run)
Allometric equations
sol_equation(id) sol_equations(id)
sol_equation(id) sol_equations(id)
id |
string: the identifier of the equation to return |
data.frame
sol_equations() sol_equation("342218_ML_Roel2000")
sol_equations() sol_equation("342218_ML_Roel2000")
Experimental. Requires the rfishbase package to be installed.
sol_fb_length_weight( ..., input_properties, return_properties, worms = requireNamespace("worrms", quietly = TRUE) )
sol_fb_length_weight( ..., input_properties, return_properties, worms = requireNamespace("worrms", quietly = TRUE) )
... |
: arguments passed to rfishbase::length_weight |
input_properties |
character: an optional vector of properties (see |
return_properties |
character: an optional vector of properties (see |
worms |
logical: if TRUE, and if the worrms package is installed, try and find the AphiaID for the taxon in the World Register of Marine Species |
A tibble of equation(s)
## Not run: library(dplyr) eq <- sol_fb_length_weight("Electrona antarctica", input_properties = "standard length") x <- tibble(SL = 10) %>% mutate(SL = sol_set_property(SL, "standard length", with_units = "cm")) sol_allometry(x, eq) ## End(Not run)
## Not run: library(dplyr) eq <- sol_fb_length_weight("Electrona antarctica", input_properties = "standard length") x <- tibble(SL = 10) %>% mutate(SL = sol_set_property(SL, "standard length", with_units = "cm")) sol_allometry(x, eq) ## End(Not run)
Create an allometric equation object
sol_make_equation( equation_id, taxon_name, taxon_aphia_id, equation, inputs, return_property, return_units, reliability, notes, reference, check_packaged_ids = TRUE, warn_recommended = TRUE )
sol_make_equation( equation_id, taxon_name, taxon_aphia_id, equation, inputs, return_property, return_units, reliability, notes, reference, check_packaged_ids = TRUE, warn_recommended = TRUE )
equation_id |
string: a unique identifier for the equation (required) |
taxon_name |
string: the taxon name that the equation applies to (required) |
taxon_aphia_id |
numeric: the AphiaID of the taxon that the equation applies to (recommended) |
equation |
function: the equation. Must return a data.frame or tibble, with at least the column "allometric_value", and optionally also "allometric_value_lower" and "allometric_value_upper" (required) |
inputs |
data.frame: the inputs needed by the equation. Must have columns "property" and "units", with entries that match those in |
return_property |
string: the name of the allometric property that the equation returns (required) |
return_units |
string: the units of measurement of the allometric property that the equation returns. Will be parsed by units::as_units (required) |
reliability |
data.frame: indicators of reliability of the equation. Must have columns "type" and "value"; see examples (recommended) |
notes |
string: any notes that users should be aware of (optional) |
reference |
bibentry: the source of the equation (recommended) |
check_packaged_ids |
logical: if TRUE, check the equation_id against the package-bundled equations. A warning will be issued if there is a packaged equation with the same ID as equation_id |
warn_recommended |
logical: issue a warning if "recommended" informations is not supplied? |
equation object
sol_equation
sol_equations
sol_properties
library(dplyr) my_ref <- bibentry(bibtype="Article",key="Lake2003", author=c(person("S","Lake"),person("H","Burton"), person("J","van den Hoff")), year=2003, title="Regional, temporal and fine-scale spatial variation in Weddell seal diet at four coastal locations in east Antarctica", journal="Marine Ecology Progress Series", volume=254,pages="293-305",doi="10.3354/meps254293") eq <- sol_make_equation(equation_id="my_equation_id", taxon_name="Chorismus antarcticus", taxon_aphia_id=369214, equation=function(L) tibble(allometric_value=0.000943*(L^2.976)), inputs=tibble(property="carapace length",units="mm", sample_minimum=6,sample_maximum=16), return_property="wet weight", return_units="g", reliability=tribble(~type,~value, "N",35, "R^2",0.976), reference=my_ref)
library(dplyr) my_ref <- bibentry(bibtype="Article",key="Lake2003", author=c(person("S","Lake"),person("H","Burton"), person("J","van den Hoff")), year=2003, title="Regional, temporal and fine-scale spatial variation in Weddell seal diet at four coastal locations in east Antarctica", journal="Marine Ecology Progress Series", volume=254,pages="293-305",doi="10.3354/meps254293") eq <- sol_make_equation(equation_id="my_equation_id", taxon_name="Chorismus antarcticus", taxon_aphia_id=369214, equation=function(L) tibble(allometric_value=0.000943*(L^2.976)), inputs=tibble(property="carapace length",units="mm", sample_minimum=6,sample_maximum=16), return_property="wet weight", return_units="g", reliability=tribble(~type,~value, "N",35, "R^2",0.976), reference=my_ref)
Properties
sol_properties(prop)
sol_properties(prop)
prop |
string: if provided, return only the property matching this name |
data.frame
sol_properties() ## all properties that solong knows about
sol_properties() ## all properties that solong knows about
Properties relating to allometric equations.
sol_properties_data
sol_properties_data
A data frame with variables:
the property name
its units of measurement
the corresponding class name used internally by the solong package
notes, including a specific definition of the property if appropriate
Set or get the property name
sol_set_property(x, prop, with_units, ...) sol_get_property(x)
sol_set_property(x, prop, with_units, ...) sol_get_property(x)
x |
vector: data |
prop |
string: property name |
with_units |
string: units of measurement to use. If missing, the default units for the property will be used |
... |
: extra arguments, currently ignored |
x with additional class set
x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) ## it doesn't matter what the column names are, but we ## need to set the property types correctly x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## remove the property x$LRL <- sol_set_property(x$LRL,NULL)
x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) ## it doesn't matter what the column names are, but we ## need to set the property types correctly x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## remove the property x$LRL <- sol_set_property(x$LRL,NULL)
Intended for use inside of sol_equation
objects.
sol_vonbert( t, Linf, k, t0, Linf_se, k_se, t0_se, reps = 1000L, ci = 0.95, method = "monte carlo" )
sol_vonbert( t, Linf, k, t0, Linf_se, k_se, t0_se, reps = 1000L, ci = 0.95, method = "monte carlo" )
t |
numeric: prediction times |
Linf |
numeric: Linf parameter estimate |
k |
numeric: k parameter estimate |
t0 |
numeric: t0 parameter estimate |
Linf_se |
numeric: Linf parameter standard error estimate |
k_se |
numeric: k parameter standard error estimate |
t0_se |
numeric: t0 parameter standard error estimate |
reps |
integer: number of Monte-Carlo samples to draw |
ci |
numeric: confidence level |
method |
string: method to use for uncertainty propagation (only "monte carlo" supported at the moment) |
A tibble with columns allometric_value
, allometric_value_lower
, allometric_value_upper
. If any of the standard error inputs are missing, NULL
, or NA
, the upper and lower estimates will be NA_real_
sol_vonbert(0:7, Linf = 80.7, Linf_se = 0.82, k = 0.25, k_se = 0.01, t0 = -2.31, t0_se = 0.01)
sol_vonbert(0:7, Linf = 80.7, Linf_se = 0.82, k = 0.25, k_se = 0.01, t0 = -2.31, t0_se = 0.01)
Provides allometric equations that relate the body size of Southern Ocean taxa to body part measurements.
A convenience function to remove the units assigned to an object.
strip_units(x)
strip_units(x)
x |
object: with units |
x, with units removed
x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## apply an allometric equation xa <- sol_allometry(x,c("342218_ML_Roel2000")) strip_units(xa$allometric_value)
x <- data.frame(LRL=c(11.3,13.9),species=c("Architeuthis dux"), stringsAsFactors=FALSE) x$LRL <- sol_set_property(x$LRL,"lower rostral length") ## apply an allometric equation xa <- sol_allometry(x,c("342218_ML_Roel2000")) strip_units(xa$allometric_value)