Arguments
- object
A
MizerParams
object or aMizerSim
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
- time_range
A vector of times. Only the range of times is relevant, i.e., all times between the smallest and largest will be selected. The time_range can be character or numeric.
- drop
If
TRUE
then any dimension of length 1 will be removed from the returned array.- ...
Unused
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
.
Your own predation mortality function
By default getPredMort()
calls mizerPredMort()
. However you can
replace this with your own alternative predation mortality function. If
your function is called "myPredMort"
then you register it in a MizerParams
object params
with
Your function will then be called instead of mizerPredMort()
, with the
same arguments.
See also
Other rate functions:
getEGrowth()
,
getERepro()
,
getEReproAndGrowth()
,
getEncounter()
,
getFMort()
,
getFMortGear()
,
getFeedingLevel()
,
getMort()
,
getPredRate()
,
getRDD()
,
getRDI()
,
getRates()
,
getResourceMort()
Examples
# \donttest{
params <- NS_params
# Predation mortality in initial state
M2 <- getPredMort(params)
str(M2)
#> num [1:12, 1:100] 3.64 4.43 4.31 4.89 4.8 ...
#> - attr(*, "dimnames")=List of 2
#> ..$ prey : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> ..$ w_prey: chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
# 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
M2 <- getPredMort(params, n = N(sim)[15, , ], n_pp = NResource(sim)[15, ])
# Get predation mortality at all saved time steps
M2 <- getPredMort(sim)
str(M2)
#> num [1:21, 1:12, 1:100] 3.64 3.42 3.29 3.2 3.16 ...
#> - attr(*, "dimnames")=List of 3
#> ..$ time : chr [1:21] "0" "1" "2" "3" ...
#> ..$ prey : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> ..$ w_prey: chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
# Get predation mortality over the years 15 - 20
M2 <- getPredMort(sim, time_range = c(15, 20))
# }