Many functions in mizer return two-dimensional arrays (species x size)
holding rates like encounter rate, feeding level, growth rate, mortality etc.
The ArraySpeciesBySize class wraps these arrays to provide convenient
print(), summary(), plot(), and as.data.frame() methods.
ArraySpeciesBySize(
x,
value_name = NULL,
units = NULL,
type = NULL,
params = NULL,
representation = c("point", "average")
)is.ArraySpeciesBySize(x)
An ArraySpeciesBySize object (inherits from matrix and array).
is.ArraySpeciesBySize() returns TRUE if x is an
ArraySpeciesBySize object, FALSE otherwise.
A matrix (species x size). For is.ArraySpeciesBySize(), any
object to test.
A string giving the human-readable name for the value.
A string giving the units (e.g. "g/year", "1/year").
The kind of quantity the values are, see array_types:
"value" (the default) for a rate or an amount, "density" for an amount
per gram of body weight, "proportion" for a fraction. This is what tells
plot() to multiply a density by the appropriate Jacobian when it is
plotted against a length axis (size_axis = "l"), and to show a proportion
against the whole of the interval from 0 to 1. The default, NULL, treats
a value_name of "Number density" or units of "1/g" as a density, the
way mizer recognised one before this attribute existed.
A MizerParams object. Used for species colours, linetypes,
and size ranges in the plot() method.
Either "point" (the default) for a quantity sampled
at the grid nodes, or "average" for a finite-volume bin average. A
bin-averaged quantity is drawn at the geometric bin centre rather than the
left bin edge, but only when the model uses second-order bin-averaging
(second_order_w[["bin_average"]]), so default plots are unchanged.
An ArraySpeciesBySize object behaves just like a regular matrix for
arithmetic operations and subsetting. It carries a few lightweight
attributes:
value_name – a human-readable name for the value
(e.g. "Encounter rate").
units – the units of the rate (e.g. "g/year").
type – the kind of quantity the values are.
# \donttest{
enc <- getEncounter(NS_params)
is.ArraySpeciesBySize(enc)
summary(enc)
# }
Run the code above in your browser using DataLab