standardUnits-methods: Standard units of measurement for a complex class object

standardUnitsR Documentation

Standard units of measurement for a complex class object

Description

Returns values for the units of each FLQuant slot according to the standard adopted by the FLR Team for the supplied class.

Usage

standardUnits(object, ...)

## S4 method for signature 'character'
standardUnits(object, ...)

## S4 method for signature 'FLS'
standardUnits(object, ...)

## S4 method for signature 'FLBiol'
standardUnits(object, ...)

Arguments

object

for which the standard units are to be returned

Details

For objects derived from class FLS, which currently includes FLStock and FLStockLen, the adopted standard includes: 'kg' for individual weights, '1000' for number of individuals, 't' for biomass, 'f' for harvest, 'm' for natural mortality, and an empty string for proportions (spwn, mat).

For objects derived of class FLBiol the adopted standard units are: 'kg' for individual weights, '1000' for number of individuals, 'm' for natural mortality, and an empty string for proportions (spwn, mat).

Value

A list with the corresponding units value for each slot

Author(s)

The FLR Team

See Also

units-FLCore

Examples

stk <- FLStock(catch=FLQuant(runif(20, 2, 120)))
# FLStock object has no units
summary(stk)
# Obtain standard units for the class as a list
standardUnits(stk)
# which can then be assigned to the object
units(stk) <- standardUnits(stk)
summary(stk)
# units<- methjod also accepts a function to be called to provide units
units(stk) <- standardUnits
bio <- FLBiol(n=FLQuant(runif(50, 2, 120), dim=c(5, 10)))
# Object has no units
summary(bio)
# Obtain standard units for the class as a list
standardUnits(bio)
# which can then be assigned to the object
units(bio) <- standardUnits(bio)
summary(stk)

flr/FLCore documentation built on May 4, 2024, midnight