Learn R Programming

bamm (version 0.5.0)

models2pam: models2pam: Converts binary rasters to a PAM

Description

Function to convert binary raster models to a Presence Absences Matrix.

Usage

models2pam(
  mods_stack,
  return_coords = FALSE,
  sparse = TRUE,
  parallel = FALSE,
  ncores = 2
)

Value

A presence-absence matrix (PAM).

Arguments

mods_stack

A raster stack containing binary models of each species in the community.

return_coords

Logical. If TRUE the pam will be returned with coordinates in the first two columns.

sparse

Logical. If TRUE the PAM will be returned as a sparse matrix.

parallel

Logical. If TRUE computations will be done in parallel

ncores

Integer. Number of cores to run the parallel process.

Author

Luis Osorio-Olvera & Jorge Soberón

Details

For more information about PAM see Soberon and Cavner (2015).

References

Soberon2015bamm.

Examples

Run this code
# \donttest{
lagos_path <- system.file("extdata/conejos",
                          package = "bamm")
enm_path <- list.files(lagos_path,
                       pattern = ".tif",
                       full.names = TRUE)[1:10]
en_models <- raster::stack(enm_path) >0.01
pam <- bamm::models2pam(en_models,
                        return_coords=TRUE,
                        sparse=FALSE,
                        parallel=FALSE,ncores=2)
head(pam)
# }

Run the code above in your browser using DataLab