Given a set of cartesian coordinates representing the locations of different objects, this function computes the distance to the nearest neighboring object for each object.
nnd(x, y, geo = FALSE)
A vector of x (or longitude) coordinates.
A vector of y (or latitude) coordinates.
A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.
A vector of the same length as x and y representing the distance to the nearest neighboring object for each object.