# \donttest{
library(terra)
# Read data from the mrangr package
## Input maps
K_map <- rast(system.file("input_maps/K_map_eg.tif", package = "mrangr"))
n1_map <- rast(system.file("input_maps/n1_map_eg.tif", package = "mrangr"))
## Interaction coefficients matrix
a <- a_eg
# Initialise simulation parameters
community_01 <-
initialise_com(
K_map = K_map,
n1_map = n1_map,
r = 1.1,
a = a,
rate = 0.002)
# With invaders
invasion <- initialise_inv(
invaders = c(1, 3),
invasion_times = c(2, 5))
community_02 <- initialise_com(
K_map = K_map,
r = 1.1,
a = a,
rate = 0.002,
invasion = invasion)
# Custom kernel function
abs_rnorm <- function(n, mean, sd) {
abs(rnorm(n, mean = mean, sd = sd))
}
community_03 <- initialise_com(
K_map = K_map,
n1_map = n1_map,
r = c(1.1, 1.05, 1.2, 1),
a = a,
kernel_fun = c("rexp", "rexp", "abs_rnorm", "abs_rnorm"),
kernel_args = list(
list(rate = 0.002),
list(rate = 0.001),
list(mean = 0, sd = 1000),
list(mean = 0, sd = 2000))
)
# }
Run the code above in your browser using DataLab