Learn R Programming

abdiv (version 0.2.0)

faith_pd: Faith's phylogenetic diversity

Description

Faith's phylogenetic diversity gives the total branch length on a phylogenetic tree that is spanned by a community. The abundance of each species in the community is not considered.

Usage

faith_pd(x, tree, x_labels = NULL)

Arguments

x

A numeric vector of species counts or proportions, or a logical vector of species presence/absence.

tree

A phylogenetic tree object..

x_labels

A character vector of species labels for x.

Value

Faith's phylogenetic diversity, \(PD \geq 0\).

Details

If the vector x is named, the names will be automatically used to match x with the tree. Missing names are filled in with zero counts. If x is not named and x_labels is provided, these labels are used to match the elements of x with the tree. If x is not named and x_labels is not provided, it is assumed that x is already in the correct order, and we simply check that its length matches the number of tips in the tree.

References

Faith DP. Conservation evaluation and phylogenetic diversity. Biol. Conserv. 1992;61:1<U+2013>10. doi: 10.1016/0006-3207(92)91201-3.

Examples

Run this code
# NOT RUN {
# Faith's phylogenetic diversity for whole tree is equal to the sum of the
# branch lengths.
sum(faith_tree$edge.length)
faith_pd(c(1, 1, 1, 1, 1), faith_tree)

# Can use named vector or additional argument to match species to tree.
faith_tree$tip.label
faith_pd(c(0, 0, 0, 10, 12), faith_tree)
faith_pd(c(d=10, e=12), faith_tree)
faith_pd(c(10, 12), faith_tree, c("d", "e"))
# }

Run the code above in your browser using DataLab