nndist {smerc} | R Documentation |
Determine nearest neighbors based on maximum distance
Description
nndist
determines the nearest
neighbors for a set of observations within a certain
radius.
Usage
nndist(d, ubd)
Arguments
d |
An |
ubd |
A proportion in (0, 1]. The distance of
potential clusters must be no more than |
Details
This function determines the nearest neighbors of each centroid based on the intercentroid distance. The number of nearest neighbors is limited by the furthest distance between the starting centroid and the farthest neighbor.
Value
Returns the indices of the nearest neighbors as a list.
Author(s)
Joshua French
Examples
data(nydf)
coords <- as.matrix(nydf[, c("longitude", "latitude")])
d <- as.matrix(dist(coords))
nn <- nndist(d, ubd = 0.01)
[Package smerc version 1.8.3 Index]