sim2Raster {bamm} | R Documentation |
sim2Raster: Convert a BAM simulation object to RasterStack
Description
Convert a BAM simulation object to RasterStack.
Usage
sim2Raster(sdm_simul, which_steps = NULL)
Arguments
sdm_simul |
A bam object. See |
which_steps |
A numeric vector indicating the simulation steps that are going to be converted into raster layers. |
Value
A RasterStack of species' distribution at each simulation step
Author(s)
Luis Osorio-Olvera & Jorge SoberĂ³n
Examples
model_path <- system.file("extdata/Lepus_californicus_cont.tif",
package = "bamm")
model <- raster::raster(model_path)
sparse_mod <- bamm::model2sparse(model,threshold=0.1)
adj_mod <- bamm::adj_mat(sparse_mod,ngbs = 1)
occs_lep_cal <- data.frame(longitude = c(-115.10417,
-104.90417),
latitude = c(29.61846,
29.81846))
occs_sparse <- bamm::occs2sparse(modelsparse = sparse_mod,
occs = occs_lep_cal)
sdm_lep_cal <- bamm::sdm_sim(set_A = sparse_mod,
set_M = adj_mod,
initial_points = occs_sparse,
nsteps = 10)
sdm_lep_cal_st <- bamm::sim2Raster(sdm_simul = sdm_lep_cal,
which_steps = seq(1,10,by=1))
raster::plot(sdm_lep_cal_st)
[Package bamm version 0.5.0 Index]