PD: Phylogenetic diversity

Description Usage Arguments Value See Also Examples

View source: R/pd.R

Description

PD calculates Faith's phylogenetic diversity.

Usage

1
PD(x, phy)

Arguments

x

a community matrix, i.e. an object of class matrix or Matrix.

phy

a phylogenetic tree (object of class phylo).

Value

a vector with the PD for all samples.

See Also

read.community read.tree phylobeta_core

Examples

1
2
3
4
5
6
7
8
library(ape)
tree <- read.tree(text ="((t1:1,t2:1)N2:1,(t3:1,t4:1)N3:1)N1;")
com <- matrix(c(1,0,1,1,0,0,
                1,0,0,1,1,0,
                1,1,1,1,1,1,
                0,0,1,1,0,1), 6, 4,
              dimnames=list(paste0("g",1:6), tree$tip.label))
PD(com, tree)

darunabas/bioregion documentation built on Oct. 27, 2019, 6:57 a.m.