wpd_table | R Documentation |
Calculates phylogenetic entropy (Hp) for each column vector s of species observations within matrix m, weighted by the frequency of each species within s. Can also calculate Faith's PD.
wpd_table(
m,
s_phylo,
s_names = NULL,
nested_set = NULL,
metric = "Hp",
ncores = 4
)
m |
numeric matrix or data.frame of weights, where columns are species and rows are samples. |
s_phylo |
phylo object. Tree containing all unique names in s as tips. Must not contain duplicate tip labels. |
s_names |
species names for m if not colnames(m). NULL will use colnames (default: NULL) |
nested_set |
matrix. The output of make_nested_set(s_phylo). If not provided, will be calculated on the fly. Precalculation only provides speedup with very large trees (default: NULL). |
metric |
character. Abbreviated name of desired tree-based phylogenetic diversity metric. Available metrics are:
|
ncores |
integer. Number of CPU cores to use for parallel operations. If set to 1, lapply will be used instead of mclapply. A warning will be shown if n_cores > 1 on Windows, which does not support forked parallelism (default: 2). |
multiple WPD or PD values, one for each column of m.
John L. Darcy
Allen B, Kon M, Bar-Yam Y (2009) A new phylogenetic diversity measure generalizing the Shannon index and its application to Phyllostomid bats. American Naturalist 174(2).
Swenson NG (2014) Functional and Phylogenetic Ecology in R. Springer UseR! Series, Springer, New York, New York, U.S.A.
Faith DP (1992) Conservation evaluation and phylogenetic diversity. Biological Conservation 61.
# library(specificity)
# set.seed(12345)
# s_phylo <- get(data(endophyte))$supertree
# w <- sample(c(0, 1), replace=TRUE, size=10)
# nspec <- 12
# m <- t(as.matrix(data.frame(
# a=runif(nspec, 0, 100),
# b=runif(nspec, 0, 100),
# c=runif(nspec, 0, 100)
# )))
# colnames(m) <- sample(s_phylo$tip.label, ncol(m))
# wpd_table(m, s_phylo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.