# \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"))
## Competition coefficients matrix
a <- a_eg
# Initialise simulation parameters
community_01 <-
initialise_com(
K_map = K_map,
r = 1.1,
a = a,
rate = 0.002)
# Update simulation parameters
# Custom kernel function
abs_rnorm <- function(n, mean, sd) {
abs(rnorm(n, mean = mean, sd = sd))
}
community_02 <- update(community_01,
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