avg_nn_dist | R Documentation |
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).
avg_nn_dist(coords)
coords |
a matrix with n-dimensional coordinates |
a vector of average distances for each sequential number of accumulated nearest samples.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.