collapse_pop_state: Extract threshold based population size information

collapse_pop_stateR Documentation

Extract threshold based population size information

Description

Given a model object, this function computes population sizes given thresholds for a state variable of interest. For example, the number (or proportion) of individuals shorter than 60 cm tall at the 20th time step of the model.

Usage

collapse_pop_state(ipm, time_step, ...)

Arguments

ipm

An object created by make_ipm

time_step

the time step to pull out. Can be a single time step or a vector of multiple time steps. In the latter case, one value is computed for each time step.

...

Named expressions that provide the threshold information for the desired classes. The expression should be logicals with a state variable name on the left side, and a threshold value on the right side.

Value

A named list of numeric vectors containing the summed population sizes at each requested time step. Names are taken from ....

Examples

data(gen_di_det_ex)

# Rebuild the model and return_main_env this time

gen_di_det_ex <- gen_di_det_ex$proto_ipm %>%
  make_ipm(iterate = TRUE, iterations = 50, return_main_env = TRUE)

disc_sizes <- collapse_pop_state(gen_di_det_ex,
                                 time_step = 20:25,
                                 seedlings = ht <= 10,
                                 NRA = ht > 10 & ht <= 200,
                                 RA = ht > 200)


levisc8/ipmr documentation built on Feb. 22, 2023, 9:15 p.m.