| subsample | R Documentation |
Reduce spatial autocorrelation by subsampling sites using various methods.
subsample(
coords,
n = NULL,
method = c("grid", "random", "thinning"),
cell_size = NULL,
min_dist = NULL,
seed = NULL
)
coords |
A data.frame with columns |
n |
Integer. Target number of sites to retain. If |
method |
Character. Subsampling method: |
cell_size |
Numeric. Grid cell size for |
min_dist |
Numeric. Minimum distance between retained sites for
|
seed |
Integer. Random seed for reproducibility. |
Methods:
"grid": Overlay a grid and retain one random site per cell.
"random": Simple random subsample of n sites.
"thinning": Iteratively remove sites until minimum distance is achieved.
Integer vector of row indices to retain.
Aiello-Lammens, M.E., Boria, R.A., Radosavljevic, A., et al. (2015). spThin: an R package for spatial thinning of species occurrence records for use in ecological niche models. Ecography, 38, 541-545.
Lennon, J.J., Koleff, P., Greenwood, J.J.D. & Gaston, K.J. (2004). Contribution of rarity and commonness to patterns of species richness. Ecology Letters, 7, 81-87.
coords <- data.frame(x = runif(50) * 100, y = runif(50) * 100)
species <- matrix(rbinom(50 * 30, 1, 0.3), nrow = 50)
keep <- subsample(coords, method = "grid", cell_size = 20)
sac <- spacc(species[keep, ], coords[keep, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.