as_ranked {rrnni}R Documentation

Convert a tree to ranked tree

Description

Convert a tree of class "phylo" to a ranked tree of class "rankedPhylo".

Usage

as_ranked(x)

Arguments

x

a tree of class "phylo"

Details

To convert a tree to a ranked tree, the tree needs to be binary (i.e., fully resolved), be rooted, and ultrametric. Typically, such tree would be produced by coalescent process.

Ranked trees are similar to time-trees, only instead of time, we care about the order of the splits.

Value

a ranked tree of class "rankedPhylo"

Examples


# this will throw an error, the tree is not ultrametric
x = ape::rtree(5)
try(as_ranked(x))

# coalescent trees can be converted without problem
y = ape::rcoal(5)
as_ranked(y)


[Package rrnni version 0.1.1 Index]