This function thins a dataset so that only observations that have a distance from each other greater than "dist_min" are retained.
Arguments
- data
An
sf::sf
data frame, or a data frame with coordinate variables. These can be defined incoords
, unless they have standard names (see details below).- dist_min
Minimum distance between points (in units appropriate for the projection, or meters for lonlat data).
- coords
A vector of length two giving the names of the "x" and "y" coordinates, as found in
data
. If left to NULL, the function will try to guess the columns based on standard namesc("x", "y")
,c("X","Y")
,c("longitude", "latitude")
, orc("lon", "lat")
Value
An object of class sf::sf
or data.frame
, the same as "data".
Details
Distances are measured in the appropriate units for the projection used. In case of raw latitude and longitude (e.g. as provided in a data.frame), the crs is set to WGS84, and units are set to meters.
This function is a modified version of the algorithm in spThin
, adapted
to work on sf
objects.