avg_nn_dist: Compute average nearest neighbor distance

Description Usage Arguments Value Examples

View source: R/mobr.R

Description

This function computes the average distance of the next nearest sample for a given set of coordinates. This method of sampling is used by the function rarefaction when building the spatial accumulation curves

Usage

1
avg_nn_dist(coords)

Arguments

coords

a matrix with n-dimensional coordinates

Value

a vector of average distances for each sequential number of accumulated nearest samples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# transect spatial arragnement
transect = 1:100
avg_nn_dist(transect)
grid = expand.grid(1:10, 1:10)
avg_nn_dist(grid)
par(mfrow=c(1,2)) 
plot(avg_nn_dist(transect), type='o', main='transect',
     xlab='# of samples', ylab='average distance')
# 2-D grid spatial arrangement
plot(avg_nn_dist(grid), type='o', main='grid',
     xlab='# of samples', ylab='average distance')

MoBiodiv/mobr documentation built on May 7, 2019, 4:58 p.m.