| tax2dist | R Documentation |
Calculates taxonomic distances between species.
tax2dist(lookup, tax_distance, precompute_dist = TRUE)
lookup |
|
tax_distance |
named |
precompute_dist |
object of class |
Two species are at the distance of the lowest taxonomic level they share.
Each row of lookup is a species, with a name of its own at the
lowest level. A name at a higher level belongs to one taxon, so it must be
under the same name at the level above wherever it appears: a genus cannot
be in two families. tax2dist() gives an error otherwise.
Without a distance matrix, metacommunity() calculates the same
diversity from the abundance of each taxon. That suits a taxonomy too large
for a matrix. A matrix for 10,000 species takes 0.8 GB, so for more species
than that tax2dist() gives an error unless precompute_dist is
set.
tax2dist() returns an object of class distance
containing a matrix of pairwise taxonomic distances
Shimatani, K. 2001. On the measurement of species diversity incorporating species differences. Oikos 93:135–147.
# Create Lookup table
Species <- c("tenuifolium", "asterolepis", "simplex var.grandiflora", "simplex var.ochnacea")
Genus <- c("Protium", "Quararibea", "Swartzia", "Swartzia")
Family <- c("Burseraceae", "Bombacaceae", "Fabaceae", "Fabaceae")
Subclass <- c("Sapindales", "Malvales", "Fabales", "Fabales")
lookup <- cbind.data.frame(Species, Genus, Family, Subclass)
# Assign values for each level (Shimatani's taxonomic distance)
tax_distance <- c(Species = 0, Genus = 1, Family = 2, Subclass = 3, Other = 4)
# Generate pairwise distances
distance <- tax2dist(lookup, tax_distance)
similarity <- dist2sim(distance, "linear")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.