nn determines the nearest neighbors for a set of
observations based on a distance matrix.
A square distance matrix for the coordinates of interest.
The number of neighbors to return (if
The method of determining the neighbors.
The default is
A logical indicating whether an observation
is a neighbor with itself. The default is
This function determine nearest neighbors in two ways: 1. number of neighbors or 2. distance.
method = "c", then
k specifies the total
number of neighbors to return for each observation.
method = "d", then
k specifies the maximum
distance for which an observation is considered a
The function returns the neighbors for each observation.
Returns a list with the nearest neighbors of each observation. For each element of the list, the indices order neighbors from nearest to farthest.
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.