Generate environmental background data is a function similar to sampleRandom function of the raster package but optimized for Ecological niche modeling.

sample_envbg(
  envlayers,
  nbg,
  nprop = NULL,
  coordinates = FALSE,
  cellIDs = FALSE,
  rseed = NULL
)

Arguments

envlayers

A raster stack or brick.

nbg

Number of points for the background data

nprop

Proportion of environmental data to be sampled. Default NULL

coordinates

Logical. If TRUE cell coordinates will be retuerned

cellIDs

Logical. If TRUE cell IDs will be retuerned

rseed

Random seed number. Default NULL

Examples

if (FALSE) { wcpath <- list.files(system.file("extdata/bios", package = "ntbox"), pattern = ".tif$", full.names = TRUE) envlayers <- raster::stack(wcpath) vals <- sample_envbg(envlayers,nbg = 3583) # Using a proportion of data vals <- sample_envbg(envlayers,nprop = 0.20) }