Description Usage Arguments Value Author(s) Examples
View source: R/reduceSpatialCorrelation.R
This function reduces the spatial clustering of a set of presence records. It is intended to reduce spatial autocorrelation, and reduce sampling bias, particularly at larger geographical scales. It takes as input a set of coordinates, a brick or stack of environmental variables, and a minimum distance, and returns a new set of coordinates in which the distance between adjacent points is equal or higher than the established minimum distance. This operation is named "thinning", and helps to reduce the spatial correlation of a presence dataset. This function applies thinning, but preserves the presence records representing the extremes of any of the predictive variables provided.
1 2 3 4 5 6 7 8 | reduceSpatialCorrelation(
xy,
variables,
minimum.distance = NULL,
random.start = FALSE,
seed = NULL,
verbose = FALSE
)
|
xy |
A data frame with two columns with coordinates x and y. Column names are irrelevant as long as the first column represents the x coordinate, and the second column represents the y coordinate. |
variables |
A raster brick or stack with environmental variables. Must be in the same reference system of |
minimum.distance |
Numeric, minimum distance between consecutive points in the output dataset. Defaults to the resolution of |
random.start |
Boolean, defaults to |
seed |
Integer determining a random seed. Only relevant when |
verbose |
Boolean. If |
A data frame with the same columns as xy
, but a lower number of records.
Blas Benito <blasbenito@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data("virtualSpecies")
data(europe2000)
xy.thinned <- reduceSpatialCorrelation(
xy = virtualSpecies$observed.presence,
variables = europe2000,
minimum.distance = 4
)
xy.thinned
#generating datasets with different starting points
#generates a different dataset with different nrow on each run
xy.thinned <- reduceSpatialCorrelation(
xy = virtualSpecies$observed.presence,
variables = europe2000,
minimum.distance = 4,
)
nrow(virtualSpecies$observed.presence)
nrow(xy.thinned)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.