getN: Calculate the number of individuals within a size range

View source: R/summary_methods.R

getNR Documentation

Calculate the number of individuals within a size range

Description

Calculates the number of individuals within user-defined size limits. The default option is to use the whole size range. You can specify minimum and maximum weight or lengths for the species. Lengths take precedence over weights (i.e. if both min_l and min_w are supplied, only min_l will be used)

Usage

getN(object, ...)

Arguments

object

An object of class MizerParams or MizerSim.

...

Arguments passed on to get_size_range_array

min_w

Smallest weight in size range. Defaults to smallest weight in the model.

max_w

Largest weight in size range. Defaults to largest weight in the model.

min_l

Smallest length in size range. If supplied, this takes precedence over min_w.

max_l

Largest length in size range. If supplied, this takes precedence over max_w.

Value

If called with a MizerParams object, a vector with the numbers for each species in the model. If called with a MizerSim object, an array (time x species) containing the numbers at each time step for all species.

See Also

Other summary functions: getBiomass(), getDiet(), getGrowthCurves(), getSSB(), getYield(), getYieldGear()

Examples

numbers <- getN(NS_sim)
numbers["1972", "Herring"]
# The above gave a huge number, because that included all the larvae.
# The number of Herrings between 10g and 1kg is much smaller.
numbers <- getN(NS_sim, min_w = 10, max_w = 1000)
numbers["1972", "Herring"]

sizespectrum/mizer documentation built on April 14, 2024, 3:08 a.m.