Learn R Programming

mizer (version 2.0.0)

getM2: Alias for getPredMort

Description

An alias provided for backward compatibility with mizer version <= 1.0

Usage

getM2(object, n, n_pp, n_other, pred_rate, time_range, drop = TRUE)

Arguments

object

A MizerParams object or a MizerSim object

n

A matrix of species abundances (species x size).

n_pp

A vector of the resource abundance by size

n_other

A list of abundances for other dynamical components of the ecosystem

pred_rate

An array of predation rates of dimension no. sp x no. community size bins x no. of size bins in whole spectra (i.e. community + resource, the w_full slot). The array is optional. If it is not provided it is calculated by the getPredRate() function.

time_range

The time_range can be character or numeric.

drop

If TRUE then any dimension of length 1 will be removed from the returned array.

Value

If a MizerParams object is passed in, the function returns a two dimensional array (prey species x prey size) based on the abundances also passed in. If a MizerSim object is passed in, the function returns a three dimensional array (time step x prey species x prey size) with the predation mortality calculated at every time step in the simulation. Dimensions may be dropped if they have length 1 unless drop = FALSE.

See Also

Other rate functions: getEGrowth(), getEReproAndGrowth(), getERepro(), getEncounter(), getFMortGear(), getFMort(), getFeedingLevel(), getMort(), getPredRate(), getRDD(), getRDI(), getResourceMort()

Examples

Run this code
# NOT RUN {
params <- newMultispeciesParams(NS_species_params_gears, inter)
# With constant fishing effort for all gears for 20 time steps
sim <- project(params, t_max = 20, effort = 0.5)
# Get predation mortality at one time step
n <- sim@n[21,,]
n_pp <- sim@n_pp[21,]
getPredMort(params,n,n_pp)
# Get predation mortality at all saved time steps
getPredMort(sim)
# Get predation mortality over the time 15 - 20
getPredMort(sim, time_range = c(15,20))
# }

Run the code above in your browser using DataLab