View source: R/spatial_thinning_class.R
spatial_thinning_class | R Documentation |
The function is a wrapper around thin from spThin package. It makes spatial thinning easy for multi-class input data set. This function is handy and flexible: can support xy coordinates, spatialPoints, or simple features. It assumes that data are in projected planar coordinates system; preferably Universal Transverse Mercator (UTM). There is no restrictions on number of columns in the data set as long as data is in the required format.
spatial_thinning_class(
data,
spatial = FALSE,
coords = c("X", "Y"),
distance,
class = "class"
)
data |
The input data. It can be either an 'sf' object, 'SpatialPoints' object, or a data frame. |
spatial |
Logical value indicating whether the input data is spatial data (either 'sf' or 'SpatialPoints'). Default is FALSE. |
coords |
The names of the coordinate variables to use for spatial operations. By default, it is set to c("X", "Y"). |
distance |
The distance threshold for thinning. Points within this distance will be reduced to a single point. |
class |
multi-class variable or strata variable. For each class thinning will be applied based on specified distance. |
Spatial thinning expect the data in the projected coordinate system, the distance value is the threshold which limits the number of observations. All the observations, in a particular class, smaller than the distance thresholds are deleted. If there are more than two classes, minimum distance between observations from each class.
A data frame containing the spatially thinned classes.
Aiello-Lammens, M. E., Boria, R. A., Radosavljevic, A. , Vilela, B. and Anderson, R. P. (2015). spThin: an Rpackage for spatial thinning of species occurrence records for use in ecological niche models. Ecography, 38:541-545. URL https://onlinelibrary.wiley.com/doi/10.1111/ecog.01132.
## load data from the package
tdat <- landcover
# Run spatial thinning (sf format)
stc <- spatial_thinning_class(data = tdat,spatial = TRUE,
coords = NULL,distance = 10000,class = "Class_name")
## Not run:
data <- landcover
spatial_thinning_class(data = landcover, spatial = TRUE, coords = NULL,
distance = 10000, class = "Class_name")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.