NN_mean: Find the mean distance to nearest neighbor for a collection...

View source: R/balance_check.R

NN_meanR Documentation

Find the mean distance to nearest neighbor for a collection of Cartesian coordinates

Description

Given a data frame containing X and Y Cartesian coordinates, find the arithmetic and geometric mean distance to the nearest point.

Usage

NN_mean(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 named numeric vector of the mean distances: "arith_mean" containing the arithmetic mean and "geo_mean" containing the geometric mean.


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