Given a set of cartesian coordinates representing the locations of different objects, this function determines the nearest neighboring object of each object.
nn(x, y, id, geo = FALSE)
A vector of x (or longitude) coordinates.
A vector of y (or latitude) coordinates.
A vector corresponding to the unique identities of each track.
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 identity of the nearest neighboring object to each object.