Function to extract nearest neighbour predictor values of provided pointsSource:
This function performs nearest neighbour matching between biodiversity observations and independent predictors, and operates directly on provided data.frames. Note that despite being parallized this function can be rather slow for large data volumes of data!
get_ngbvalue( coords, env, longlat = TRUE, field_space = c("x", "y"), cheap = FALSE, ... )
data.frameobject with the predictors.
logicalvariable indicating whether the projection is long-lat.
vectorhighlight the columns from which coordinates are to be extracted (Default:
logicalvariable whether the dataset is considered to be large and faster computation could help.
data.frame with the extracted covariate data from each provided
Nearest neighbour matching is done via the geodist R-package
If multiple values are of equal distance during the nearest neighbour check, then the results is by default averaged.
Mark Padgham and Michael D. Sumner (2021). geodist: Fast, Dependency-Free Geodesic Distance Calculations. R package version 0.0.7. https://CRAN.R-project.org/package=geodist