sol_make_equation: Create an allometric equation object

View source: R/equations.R

sol_make_equationR Documentation

Create an allometric equation object

Description

Create an allometric equation object

Usage

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
)

Arguments

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 sol_properties. Optionally also "sample_minimum" and "sample_maximum" if known (describing the range of the data used to generate the equation) (required)

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?

Value

equation object

See Also

sol_equation sol_equations sol_properties

Examples

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)


SCAR/solong documentation built on Aug. 5, 2022, 9:04 p.m.