Learn R Programming

mrangr (version 1.0.1)

initialise_inv: Initialise Invasion Parameters

Description

Prepares a list of invasion configuration details, including the identifiers of the invading species, the times of invasion and the number of individuals introduced at each event. Result of this helper function is designed to be passed to initialise_com() as invasion argument.

Usage

initialise_inv(invaders, invasion_times, propagule_size = 1)

Value

A named list with the following components:

invaders

Integer vector of invading species indices.

propagule_size

Number of individuals introduced per invasion event.

invasion_times

Matrix of invasion times, with one row per invader.

Arguments

invaders

An integer vector of species indices indicating which species are invaders.These indices should match the species layers in the input maps (n1_map and K_map).

invasion_times

A matrix or vector specifying when each invader enters the system. If a vector is provided, it is assumed to apply to all invaders. If a matrix, it must have one row per invader and columns corresponding to invasion events.

propagule_size

A numeric scalar specifying the number of individuals introduced at each invasion time. Defaults to 1.

Examples

Run this code
# Define invaders and invasion times
initialise_inv(
  invaders = c(1, 3),
  invasion_times = matrix(c(5, 10, 5, 20), nrow = 2, byrow = TRUE),
  propagule_size = 10
)

# Uniform invasion times across all invaders
initialise_inv(
  invaders = c(2, 4),
  invasion_times = c(5, 10, 15)
)

Run the code above in your browser using DataLab