Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read.newick

Robust Newick style tree reader


Description

This function reads a Newick style tree from file.

Usage

read.newick(file="", text, ...)

Arguments

file

name of text file with single Newick style tree or multiple trees, one per line.

text

character string containing tree.

...

optional arguments to be passed to scan. Note that if the arguments sep or what are supplied this could generate an error. Useful optional arguments might include skip (number of lines to skip) and nlines (number of lines to read).

Details

This function is almost completely redundant with read.tree; however it is 'robust' in that it does not fail if the tree contains so-called 'singles' (nodes with only one descendant).

Value

An object of class "phylo", possibly containing singles (see collapse.singles).

Author(s)

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

Examples

tree<-"((Human,Chimp),Gorilla),Monkey);"
phy<-read.newick(text=tree)

phytools

Phylogenetic Tools for Comparative Biology (and Other Things)

v0.7-70
GPL (>= 2)
Authors
Liam J. Revell
Initial release
2020-9-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.