nndist | R Documentation |

`nndist`

determines the nearest
neighbors for a set of observations within a certain
radius.

```
nndist(d, ubd)
```

`d` |
An |

`ubd` |
A proportion in (0, 1]. The distance of
potential clusters must be no more than |

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.

Returns the indices of the nearest neighbors as a list.

Joshua French

```
data(nydf)
coords <- as.matrix(nydf[, c("longitude", "latitude")])
d <- as.matrix(dist(coords))
nn <- nndist(d, ubd = 0.01)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.