Package 'solong'

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

Help Index


Allometric equation data.

Description

A dataset containing allometric equations (relationships between the size of an organism and the size of its body parts).

Usage

allometric_equations

Format

A data frame with variables:

equation_id

the identifier of this equation

taxon_name

name of the taxon

taxon_aphia_id

the Aphia ID of the taxon (identifier within the World Register of Marine Species)

equation

a function encoding the allometric equation

inputs

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')

return_property

the name of the body size characteristic that is estimated by this equation (e.g. 'mantle length')

return_units

the units of measurement of the returned property

reliability

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

notes

reference

the source of the equation


Apply allometric equations

Description

Apply allometric equations

Usage

sol_allometry(data, equation)

Arguments

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

Value

the input data frame, augmented with columns "allometric_property", "allometric_value", "allometric_value_lower", and "allometric_value_upper"

See Also

allometric_equations

Examples

## 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

Description

Allometric equations

Usage

sol_equation(id)

sol_equations(id)

Arguments

id

string: the identifier of the equation to return

Value

data.frame

Examples

sol_equations()
sol_equation("342218_ML_Roel2000")

Create allometric equation from Fishbase

Description

Experimental. Requires the rfishbase package to be installed.

Usage

sol_fb_length_weight(
  ...,
  input_properties,
  return_properties,
  worms = requireNamespace("worrms", quietly = TRUE)
)

Arguments

...

: arguments passed to rfishbase::length_weight

input_properties

character: an optional vector of properties (see link{sol_properties}). Only equations that take an input in input_properties will be returned

return_properties

character: an optional vector of properties (see link{sol_properties}). Only equations that return a value in return_properties will be returned

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

Value

A tibble of equation(s)

See Also

sol_equation sol_equations

Examples

## 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

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)

Properties

Description

Properties

Usage

sol_properties(prop)

Arguments

prop

string: if provided, return only the property matching this name

Value

data.frame

See Also

sol_set_property

Examples

sol_properties() ## all properties that solong knows about

Properties relating to allometric equations.

Description

Properties relating to allometric equations.

Usage

sol_properties_data

Format

A data frame with variables:

property

the property name

units

its units of measurement

class_name

the corresponding class name used internally by the solong package

notes

notes, including a specific definition of the property if appropriate


Set or get the property name

Description

Set or get the property name

Usage

sol_set_property(x, prop, with_units, ...)

sol_get_property(x)

Arguments

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

Value

x with additional class set

See Also

sol_properties

Examples

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)

Von Bertalanffy growth equation with optional propagation of uncertainty

Description

Intended for use inside of sol_equation objects.

Usage

sol_vonbert(
  t,
  Linf,
  k,
  t0,
  Linf_se,
  k_se,
  t0_se,
  reps = 1000L,
  ci = 0.95,
  method = "monte carlo"
)

Arguments

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)

Value

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_

Examples

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)

solong

Description

Provides allometric equations that relate the body size of Southern Ocean taxa to body part measurements.


Remove the units from an object

Description

A convenience function to remove the units assigned to an object.

Usage

strip_units(x)

Arguments

x

object: with units

Value

x, with units removed

Examples

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)