Learn R Programming

rdiversity (version 1.0)

smatrix: Phylogenetic similarity matrix (ultrametric)

Description

Function to calculate an ultrametric-similarity matrix.

Usage

smatrix(ps)

Arguments

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)
smatrix(ps)

# }

Run the code above in your browser using DataLab