NN: Find the distances to nearest neighbor for a collection of...

View source: R/balance_check.R

NNR Documentation

Find the distances to nearest neighbor for a collection of Cartesian coordinates

Description

Given a data frame containing X and Y Cartesian coordinates, find the distance to the nearest point for each point in the data frame.

Usage

NN(dataframe, x_var, y_var)

Arguments

dataframe

A data frame. Must contain numeric variables corresponding to x_var and y_var containing the X and Y coordinate values.

x_var

Character string. The name of the variable in dataframe containing the X components of the coordinates.

y_var

Character string. The name of the variable in dataframe containing the Y components of the coordinates.

Value

A numeric vector of the distances, one for each point.


nstauffer/sample.design documentation built on May 9, 2022, 3:21 a.m.