# \donttest{
# input maps
library(terra)
n1_small <- rast(system.file("input_maps/n1_small.tif", package = "rangr"))
K_small <- rast(system.file("input_maps/K_small.tif", package = "rangr"))
K_small_changing <- rast(system.file("input_maps/K_small_changing.tif",
package = "rangr"))
n1_small_lon_lat <- rast(system.file("input_maps/n1_small_lon_lat.tif", package = "rangr"))
K_small_lon_lat <- rast(system.file("input_maps/K_small_lon_lat.tif", package = "rangr"))
# basic example
sim_data_1 <- initialise(
n1_map = n1_small,
K_map = K_small,
r = log(2),
rate = 1 / 1e3
)
# example with changing environment
K_interpolated <- K_get_interpolation(
K_small_changing,
K_time_points = c(1, 25, 50)
)
sim_data_2 <- initialise(
n1_map = n1_small,
K_map = K_interpolated,
r = log(2),
rate = 1 / 1e3
)
# example with lon/lat rasters
sim_data_3 <- initialise(
n1_map = n1_small_lon_lat,
K_map = K_small_lon_lat,
r = log(2),
rate = 1 / 1e3
)
# example without progress bar and messages
sim_data_4 <- initialise(
n1_map = n1_small, K_map = K_small, K_sd = 0.1, r = log(5),
r_sd = 4, growth = "ricker", rate = 1 / 200,
max_dist = 5000, dens_dep = "K2N", progress_bar = FALSE, quiet = TRUE
)
# }
Run the code above in your browser using DataLab