nearestspecies: Find nearest species compositional neighbors among two...

Description Usage Arguments Details Value Examples

Description

Given two species abundance matrices (of possibly unequal size), find nearest species compositional neighbors.

Usage

1
nearestspecies(spe1, spe2, method, ties = FALSE, ...)

Arguments

spe1

species abundance matrix with greater number of sites (rows)

spe2

species abundance matrix with lesser number of sites (rows)

method

dissimilarity index, per vegdist; default uses Bray-Curtis dissimilarities with stepacross adjustment

ties

logical, should ties (non-unique values) be allowed? default is FALSE

...

additional arguments passed to function

Details

Useful to subset the longer of two datasets for analyses that require compatible dimensions (e.g., mantel, procrustes).

If ties = FALSE, then all returned values are unique; if ties = TRUE, then unique values are not enforced, so any sample unit in spe1 may be picked repeatedly.

Value

Numeric vector indexing rows (sample units) in spe1 which are nearest compositional neighbors of spe2. The order corresponds to row order in spe2.

Examples

 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)

phytomosaic/fitNMDS documentation built on May 17, 2019, 8:19 p.m.