Description Usage Arguments Value Examples
Get 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.
1 | coords_to_knn(x, k = min(10, nrow(x)), method = "euclidean", p = 2)
|
x |
a numeric matrix, data frame or |
k |
The number of nearest neighbors, counting the location itself. |
method |
the distance measure to be used. This must be one of
|
p |
The power of the Minkowski distance. |
An integer matrix of the k nearest neighbors for each location. Each row corresponds to a location, with the first element of each row being the location itself. Locations are encoded as integers.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.