Learn R Programming

rrnni (version 0.1.1)

rankedPhylo: Create a ranked tree

Description

Create a new, or coerce character vector or an existing tree into a ranked tree.

Usage

rankedPhylo(x)

# S3 method for default rankedPhylo(x)

# S3 method for numeric rankedPhylo(x)

# S3 method for character rankedPhylo(x)

# S3 method for phylo rankedPhylo(x)

# S3 method for multiPhylo rankedPhylo(x)

Value

ranked tree or trees of class rankedPhylo or multiRankedPhylo

Arguments

x

a numeric vector, character vector or a object of class phylo or multiPhylo, see details.

Details

This is a wrapper for multiple functions that create a ranked tree. As such, it accepts multiple types of inputs and produce either rankedPhylo or a collated list of ranked trees as a multiRankedPhylo.

If x is a numeric vector, create n = length(x) random ranked tree using the random_tree function. If x is a character vector, try to read the character as a newick-formatted tree. If x is object of a class phylo or multiPhylo, coerce these objects into rankedPhylo or multiRankedPhylo using the as_ranked function.

Examples

Run this code

# Create a single random ranked tree with 5 tips
rankedPhylo(5)

# Create multiple random ranked trees with 5 tips
rankedPhylo(c(5,5,5))

# Convert a coalescent tree into a ranked tree
x = ape::rcoal(5) # random coalescent tree
rankedPhylo(x)

Run the code above in your browser using DataLab