View source: R/subset.sim_results.R
subset.sim_results | R Documentation |
sim_results
ObjectThis function creates a subset of given time points from the sim_results
object.
## S3 method for class 'sim_results'
subset(x, from = NULL, time_points = NULL, ...)
x |
|
from |
numeric vector of length 1; indicates the starting time point from which all time point should be kept |
time_points |
numeric vector; indicates all time points to keep |
... |
further arguments to be passed to or from other methods |
Either from
or time_points
argument has to be specified.
Time point passed by the from
argument will be set as a cutoff point
and all abundances for previous time points will be discarded.
sim_results
object with only selected time_points
present
in the N_map
slot
# data preparation
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"))
sim_data <- initialise(
n = n1_small,
r = log(2),
K_map = K_small,
max_dist = 1000,
rate = 1 / 1e3
)
sim_results <- sim(sim_data, time = 10)
summary(sim_results)
sim_results_cropped <- subset(sim_results, time_points = c(1:2))
summary(sim_results_cropped)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.