phylobeta_core computes efficiently for large community matrices and trees the necessary quantities used by the betapart package to compute pairwise and multiple-site phylogenetic dissimilarities.

phylobeta_core(x, phy)

phylobeta(x, phy, index.family = "sorensen")

Arguments

x

an object of class Matrix, matrix or phyloseq

phy

a phylogenetic tree (object of class phylo)

index.family

family of dissimilarity indices, partial match of "sorensen" or "jaccard".

Value

phylobeta_core returns an object of class "phylo.betapart", see phylo.betapart.core for details. This object can be called by phylo.beta.pair or phylo.beta.multi.

phylobeta returns a list with three phylogenetic dissimilarity matrices. See phylo.beta.pair for details.

See also

read.community, phylo.betapart.core, beta_core

Author

Klaus Schliep

Examples

library(ape)
tree <- read.tree(text = "((t1:1,t2:1)N2:1,(t3:1,t4:1)N3:1)N1;")
com <- sparseMatrix(c(1,3,4,1,4,5,1,2,3,4,5,6,3,4,6),
  c(1,1,1,2,2,2,3,3,3,3,3,3,4,4,4),x=1,
  dimnames = list(paste0("g", 1:6), tree$tip.label))
com
#> 6 x 4 sparse Matrix of class "dgCMatrix"
#>    t1 t2 t3 t4
#> g1  1  1  1  .
#> g2  .  .  1  .
#> g3  1  .  1  1
#> g4  1  1  1  1
#> g5  .  1  1  .
#> g6  .  .  1  1

pbc <- phylobeta_core(com, tree)
pb <- phylobeta(com, tree)