Learn R Programming

rdiversity (version 1.0)

phy_struct: Calculate phylogenetic structure matrix

Description

Converts an object into class phylo into class phy_struct.

Usage

phy_struct(tree, partition)

Arguments

tree

object of class phylo

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.

Value

Returns a list containing:

$structure - each row denotes historical species, columns denote terminal taxa, and elements contain 'branch lengths / tbar'
$parameters - information associated with each historical species
$tree - object of class phylo

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)

res <- phy_struct(tree, partition)

# }

Run the code above in your browser using DataLab