metrics | R Documentation |
Time series summaries of complex objects are commonly needed, for example for
plotting the inputs and outputs of a class like FLStock
. These
methods allow for simple specification of those metrics by means of function
calls and formulas.
metrics(object, metrics, ...)
## S4 method for signature 'FLComp,list'
metrics(object, metrics, ...)
## S4 method for signature 'FLS,missing'
metrics(object, metrics, ...)
## S4 method for signature 'FLBiol,missing'
metrics(object, metrics, ...)
object |
A complex FLR object from which to extract time series metrics. |
metrics |
A named list of function, expressions or function names. |
... |
Extra definitions for metrics to be added to the class defaults |
A set of default metrics are defined for each class, as listed below. A call to the metrics method with no 'metrics' argument will return the default ones. Extra metrics can be computed by passing them as named arguments, like in ther examples below.
An object, generally of class FLQuants
.
The FLR Team
FLComp, linkFLStock, FLBiol
data(ple4)
# missing
metrics(ple4)
# metrics = function
metrics(ple4, metrics=function(x) FLQuants(SSB=ssb(x), REC=rec(x),
F=fbar(x), SSBREC=ssb(x) / rec(x)))
# metrics = formula
metrics(ple4, metrics=~ssb)
metrics(ple4, metrics=list(SSB=~ssb))
metrics(ple4, metrics=list(SBMSY=~ssb/SBMSY), FLPar(SBMSY=3.87e4))
# metrics = list
metrics(ple4, metrics=list(SSB=ssb, REC=rec, F=fbar))
metrics(ple4, metrics=list(SSB=~ssb, REC=rec, F=fbar))
data(ple4)
# Get default metrics
metrics(ple4)
# Adds to defaults
metrics(ple4, PG=function(x) stock.n(x)[10,])
# Defines metrics to be computed
metrics(ple4, metrics=list(PG=function(x) stock.n(x)[10,]))
data(ple4.biol)
# Get default metrics
metrics(ple4.biol)
# Adds to defaults
metrics(ple4.biol, PG=function(x) n(x)[10,])
# Defines metrics to be computed
metrics(ple4.biol, metrics=list(PG=function(x) n(x)[10,]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.