Learn R Programming

ggphylo (version 0.1)

tree.read: Reads a tree and returns a phylo object. Note: this function was taken largely from the ape code base, but some alterations were made in order to support NHX formatted trees and to fix some bugs. Only files and strings with a single tree are allowed.

Description

Reads a tree and returns a phylo object. Note: this function was taken largely from the ape code base, but some alterations were made in order to support NHX formatted trees and to fix some bugs. Only files and strings with a single tree are allowed.

Usage

tree.read(x, remove.whitespace = F)

Arguments

x,
string or filename containing the Newick- or NHX- formatted tree string, or a file containing such a string, to be read.
remove.whitespace
boolean, TRUE to remove whitespace from the tree, FALSE to retain whitespace. (defaults to FALSE)

Value

phylo object containing the tree (and associated annotations, if any)

Examples

Run this code
str <- '((a,b),c)'
x <- tree.read(str)
print(as.character(x))

Run the code above in your browser using DataLab