read.newick: Newick or Nexus style tree reader

View source: R/read.newick.R

read.newickR Documentation

Newick or Nexus style tree reader


Reads a phylogenetic tree from file.


read.newick(file="", text, ...)
readNexus(file="", format=c("standard","raxml"))



name of text file with single Newick style tree or multiple trees, one per line. For readNexus this should be a Nexus format tree.


character string containing tree.


file format (source) for readNexus. In the case of format="standard", from ape will be used internally. For format="raxml", the parser assumes that bootstrap values have been stored as node labels in the format [&label=bootstrap].


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


The function read.newick reads a simple Newick style tree from file. This function is now almost completely redundant with read.tree. At the time of development, however, it was more 'robust' than read.tree in that it didn't fail if the tree contained so-called 'singles' (nodes with only one descendant); however, read.tree can now handle singleton nodes without difficulty.

The function readNexus reads a Nexus formatted tree, optionally with bootstrap values as node labels. This function can read a simple Nexus formatted tree from file (like; however, it can also parse the node labels as bootstrap values. This is the output format from the software RAxML. For Nexus tree files with complex node labels (e.g., from the software MrBayes) it will probably fail to parse node labels correctly, if at all.


An object of class "phylo", possibly containing singletons (see; or an object of class "multiPhylo".


Liam Revell


Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also




phytools documentation built on June 22, 2024, 10:39 a.m.