sample_envbg: Generate random environmental background data

Description Usage Arguments Examples

View source: R/sample_envbg.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
sample_envbg(
  envlayers,
  nbg,
  nprop = NULL,
  coordinates = FALSE,
  cellIDs = FALSE,
  rseed = NULL,
  ncores = 4
)

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 returned

cellIDs

Logical. If TRUE cell IDs will be returned

rseed

Random seed number. Default NULL

ncores

Number of workers to run the parallel process.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
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)

## End(Not run)

luismurao/hsi documentation built on Dec. 26, 2021, 9:53 a.m.