nnd: Nearest Neihgbor Distance

View source: R/nn.R

nndR Documentation

Nearest Neihgbor Distance

Description

Given the locations of different objects, this function determines the distance of the nearest neighboring object to each object.

Usage

nnd(x, y, geo = FALSE)

Arguments

x

A vector of x (or longitude) coordinates.

y

A vector of y (or latitude) coordinates.

geo

A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.

Value

A vector of the same length as x and y representing the distance to the nearest neighboring object for each object.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

nn

Examples

x <- rnorm(25)
y <- rnorm(25, sd = 3)
id <- 1:25
nnd(x, y)


swarm-lab/swaRm documentation built on Dec. 3, 2023, 9:30 p.m.