knn_zones {scanstatistics} | R Documentation |
k
nearest neighbors for all locations.Returns the set of increasing nearest neighbor sets for all locations, as
a list of integer vectors. That is, for each location the list returned
contains one vector containing the location itself, another containing the
location and its nearest neighbor, and so on, up to the vector containing the
location and its k-1
nearest neighbors.
knn_zones(k_nearest)
k_nearest |
An integer matrix of with |
A list of integer vectors.
nn <- matrix(c(1L, 2L, 4L, 3L, 5L,
2L, 1L, 3L, 4L, 5L,
3L, 2L, 4L, 1L, 5L,
4L, 1L, 2L, 3L, 5L,
5L, 3L, 4L, 2L, 1L),
ncol = 5, byrow = TRUE)
knn_zones(nn[, 1:3])