Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

neighbors

Neighbors


Description

Calculates the nearest neighbors in a distance/dissimilarity matrix

Usage

neighbors(dis,numnbr)

Arguments

dis

an object of class ‘dist’ such as returned by dist, vegdist or dsvdis

numnbr

the number (order) of neighbors to return

Details

For each sample unit in a dissimilarity matrix finds the ‘numnbr’ nearest neighbors and returns them in order.

Value

Returns a data.frame with sample units as rows and neighbors as columns, listed in order of proximity to the sample unit.

Author(s)

References

Examples

data(bryceveg) # returns a data.frame called veg
dis.bc <- dsvdis(bryceveg,'bray/curtis')
neighbors(dis.bc,5)

labdsv

Ordination and Multivariate Analysis for Ecology

v2.0-1
GPL (>= 2)
Authors
David W. Roberts <droberts@montana.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.