| sim2Raster | R Documentation | 
Convert a BAM simulation object to RasterStack.
sim2Raster(sdm_simul, which_steps = NULL)
sdm_simul | 
 A bam object. See   | 
which_steps | 
 A numeric vector indicating the simulation steps that are going to be converted into raster layers.  | 
A RasterStack of species' distribution at each simulation step
## Not run: 
model_path <- system.file("extdata/Lepus_californicus_cont.tif",
                          package = "bam")
model <- raster::raster(model_path)
sparse_mod <- bam::model2sparse(model)
adj_mod <- bam::adj_mat(sparse_mod,nbgs=1)
occs_lep_cal <- data.frame(longitude = c(-115.10417,
                                         -104.90417),
                           latitude = c(29.61846,
                                        29.81846))
occs_sparse <- bam::occs2sparse(modelsparse = sparse_mod,
                                occs = occs_lep_cal)
sdm_lep_cal <- bam::sdm_sim(set_A = sparse_mod,
                            set_M = adj_mod,
                            initial_points = occs_sparse,
                            nsteps = 100)
sdm_lep_cal_st <- bam::sim2Raster(sdm_simul = sdm_lep_cal,
                                  which_steps = seq(1,100,by=5))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.