Learn R Programming

rdiversity (version 1.0)

zmatrix: Similarity matrix

Description

Function to calculate a phylogenetic similarity matrix.

Usage

zmatrix(partition, s, ps)

Arguments

partition

two-dimensinal matrix of mode numeric with rows as types, columns as subcommunities, and elements containing relative abundances of types in subcommunities. In the case of phylogenetic metacommunities, these are the relative abundances of terminal taxa.

s

smatrix() output; ultrametric-similarity matrix.

ps

phy_struct() output.

Value

Returns an \(hS x hS\) matrix; pair-wise similarity of historic species.

Examples

Run this code
# NOT RUN {
tree <- ape::rtree(n = 5)
tree$tip.label <- paste0("sp", seq_along(tree$tip.label))
partition <- cbind(a = c(1,1,1,0,0), b = c(0,1,0,1,1))
row.names(partition) <- tree$tip.label
partition <- partition / sum(partition)
ps <- phy_struct(tree, partition)
s <- smatrix(ps)

zmatrix(partition, s, ps)

# }

Run the code above in your browser using DataLab