rankedPhylo {rrnni}R Documentation

Create a ranked tree

Description

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

Usage

rankedPhylo(x)

## Default S3 method:
rankedPhylo(x)

## S3 method for class 'numeric'
rankedPhylo(x)

## S3 method for class 'character'
rankedPhylo(x)

## S3 method for class 'phylo'
rankedPhylo(x)

## S3 method for class 'multiPhylo'
rankedPhylo(x)

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.

Value

ranked tree or trees of class rankedPhylo or multiRankedPhylo

Examples


# 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)


[Package rrnni version 0.1.1 Index]