Get the k nearest neighbors for each location, given its coordinates.
Source:R/zones.R
coords_to_knn.RdGet the k nearest neighbors for each location, including the location itself.
This function calls dist, so the options for the
distance measure used is the same as for that one. Distances are calculated
between rows.
Arguments
- x
a numeric matrix, data frame or
"dist"object.- k
The number of nearest neighbors, counting the location itself.
- method
the distance measure to be used. This must be one of
"euclidean","maximum","manhattan","canberra","binary"or"minkowski". Any unambiguous substring can be given.- p
The power of the Minkowski distance.
