Given two species abundance matrices (of possibly unequal size), find nearest species compositional neighbors.
species abundance matrix with greater number of sites (rows)
species abundance matrix with lesser number of sites (rows)
dissimilarity index, per
logical, should ties (non-unique values) be allowed?
additional arguments passed to function
Useful to subset the longer of two datasets for analyses that
require compatible dimensions (e.g.,
ties = FALSE, then all returned values are unique;
ties = TRUE, then unique values are not enforced, so
any sample unit in
spe1 may be picked repeatedly.
Example of first use is in Smith and Gray (2018).
Numeric vector indexing rows (sample units) in
are nearest compositional neighbors of
spe2. The order
corresponds to row order in
Smith, R. J., and A. N. Gray. 2018. Combining potentially incompatible community datasets when harmonizing forest inventories in subarctic Alaska. Journal of Vegetation Science: accepted.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# two candidate datasets, full and partial set.seed(181) data(smoky) full <- smoky$spe part <- (full + abs(rnorm(prod(dim(full)), 0, 25)))[1:6,] # subset the full matrix, based on compositional nearest neighbors i <- nearestspecies(full, part, ties=FALSE) i full <- full[i,,] # default is to break ties nearestspecies(full, part, ties=FALSE) nearestspecies(full, part, ties=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.