Function to extract nearest neighbour predictor values of provided points
Source:R/utils-spatial.R
get_ngbvalue.Rd
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!
Usage
get_ngbvalue(
coords,
env,
longlat = TRUE,
field_space = c("x", "y"),
cheap = FALSE,
...
)
Arguments
- coords
A
matrix
,data.frame
orsf
object.- env
A
data.frame
object with the predictors.- longlat
A
logical
variable indicating whether the projection is long-lat.- field_space
A
vector
highlight the columns from which coordinates are to be extracted (Default:c('x','y')
).- cheap
A
logical
variable whether the dataset is considered to be large and faster computation could help.- ...
other options.
Value
A data.frame
with the extracted covariate data from each provided
data point.
Details
Nearest neighbour matching is done via the geodist R-package (geodist::geodist
).
Note
If multiple values are of equal distance during the nearest neighbour check, then the results is by default averaged.