avg_nn_dist {mobr} | R Documentation |
Compute average nearest neighbor distance
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, sample-based rarefaction curves (sSBR).
Usage
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
# transect spatial arrangement
transect = 1:100
avg_nn_dist(transect)
grid = expand.grid(1:10, 1:10)
avg_nn_dist(grid)
oldpar <- par(no.readonly = TRUE)
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')
par(oldpar)
[Package mobr version 2.0.2 Index]