population_results: Nested functions for initializing, calculating and collecting...

View source: R/population_results.R

population_resultsR Documentation

Nested functions for initializing, calculating and collecting population simulator results.

Description

Modular functions for the population simulator for initializing, calculating and collecting simulator results.

Usage

population_results(
  replicates,
  time_steps,
  coordinates,
  initial_abundance,
  results_selection = NULL,
  result_stages = NULL
)

Arguments

replicates

Number of replicate simulation runs.

time_steps

Number of simulation time steps.

coordinates

Data frame (or matrix) of X-Y population coordinates.

initial_abundance

Matrix of initial abundances at each stage (in rows) for each population (in columns).

results_selection

List of results selection from: "abundance" (default), "ema", "extirpation", "extinction_location", "harvested", "occupancy"; "summarize" (default) or "replicate".

result_stages

Array of booleans or numeric (0, 1, 2, ...) for each stage to indicate which stages are included/combined (each unique digit > 0; optionally named) in the results (default is 1 for all stages).

Value

List of result functions:

initialize_attributes = function())

Constructs and returns an initialized nested list for the selected result attributes.

initialize_replicate = function(results)

Initializes and returns nested result attributes at the start of each replicate.

calculate_at_timestep = function(r, tm, stage_abundance, harvested, results)

Appends and calculates (non-NULL) results and returns nested result attributes at the end of each time step (tm) within replicate (r).

finalize_attributes = function(results)

Finalizes result calculations at the end of the simulation.


poems documentation built on Oct. 7, 2023, 9:06 a.m.