Skip to contents

Generates a pool of candidate sites (random or on a systematic grid) within a raster's extent, restricted to valid (non-NA) cells, and extracts their environmental values.

Usage

ss_alt_candidates(
  raster_data,
  n_candidates,
  method = c("random", "systematic"),
  spacing = NULL,
  seed = NULL
)

Arguments

raster_data

A SpatRaster stack of environmental covariates.

n_candidates

Integer, number of candidate sites to generate.

method

"random" (default) or "systematic" (regular grid).

spacing

Numeric, grid spacing for method = "systematic" (in raster coordinate units). If NULL (default), calculated from the raster extent to approximate n_candidates.

seed

Optional integer seed for reproducibility.

Value

A data frame with site_id, x, y, type ("candidate"), and one column per raster layer.

Examples

if (FALSE) { # \dontrun{
r <- terra::rast("data/predictors.tif")
candidates <- ss_alt_candidates(r, n_candidates = 1000, seed = 123)
} # }