An Interface to the Nexus Class Library

An interface to the Nexus Class Library which allows parsing of NEXUS, Newick and other phylogenetic tree file formats. It provides elements of the file that can be used to build phylogenetic objects such as ape's 'phylo' or phylobase's 'phylo4(d)'. This functionality is demonstrated with 'read_newick_phylo()' and 'read_nexus_phylo()'.

title: An R interface to the NEXUS Class Library

Build Status Build status Coverage Status Research software impact

This R package provides an interface to the C++ library NCL. It can parse efficiently common file formats used to store phylogenetic trees, especially NEXUS and Newick files.

This package is primarily intended to be used by package developers as it extracts the elements needed to build R objects that represent the content of the file. For instance, phylobase uses rncl to extract trees and/or data stored in NEXUS and Newick files to create objects of class phylo4 or phylo4d.

The package however provides two functions for users: read_nexus_phylo() and read_newick_phylo(). They read NEXUS and Newick files respectively, and return (a valid) phylo or multiPhylo object from the package ape. These functions differ from those found in ape (respectively read.tree and as rncl functions can read trees with singletons, and missing branch lengths. However, rncl adheres to the NEXUS standards and only accepts tip labels without white spaces and tip labels cannot be duplicated in the same tree.

Development versions for Windows

Because this package contains some C++ code, it can be tricky to build if you are using Windows. Unless you need a feature only available on GitHub, install rncl from CRAN.

Otherwise, you can obtain a binary version from here (unless the AppVeyor badge on top is gray, in which case you can download an older version or come back in a few minutes, or red meaning the current version is broken and you need to get an older version). Once in appveyor, look for the file named where X.Y.Z represent the version number (e.g., Then you can install this compiled version of the package directly from R.


rncl 0.8.3

  • Maintenance release that fixes notes and warnings from CRAN checks.

rncl 0.8.2

New features

  • The re-numbering of the edge matrix to deal with singleton is now performed in C++, leading to improved speed (about 3x for a 1700 tip tree) (#11).

  • A progress bar is displayed when removing the singleton, which is useful when the tree is very large.

Major changes

  • the components of the edge matrix are storred as integer (they were storred as double. (#17, reported by @KlausVigo)

rncl 0.6.0

New features

  • rncl now allows the parsing of tree files where the trees contain a subset of the taxa listed in the TAXA block.

Major changes

  • Missing edge lengths are now represented by -999 instead of -1 in the object returned by the rncl function.

rncl 0.4.0

New features

  • rncl now allows the parsing of tree files that contain some missing edge lengths, using the missing_edge_length argument in the read_newick_phylo and read_nexus_phylo. By default, if a tree has at least one missing edge length, all edge lengths are dropped. Alternatively, the user can provide a numeric value that will be used to replace all missing edge lengths. (#33 from rotl)

  • If read_newick_phylo and read_nexus_phylo return a list of trees, the elements of the list are named according to the names found in the tree file.

Major changes

  • Parsing tree files is now quiet, the default output of NCL is silenced. Because of the implementation of this output, it's difficult to give control to the user over this, but it's probably best to keep it quiet rather than having unneeded messages pollute the screen.

  • The documentation of the function rncl is improved.

  • The function make_phylo is now deprecated and will be removed in the next version. Use read_newick_phylo or read_nexus_phylo instead.

Minor changes

  • The option spacesAsUnderscore now also applies to the slot taxaNames and not only to the elements of the slot taxonLabelVector.

  • If the file parsed contains trees that only include a subset of the taxa listed in the NEXUS taxa block, the function fails more explicitly.

Bug fixes

  • The slot treeNames had duplicated values for each tree name.
  • Labels could have been assigned to the incorrect tips in some NEXUS files

rncl 0.2.2

  • change roles in authors to have a single creator ('cre')
  • fix typo in documentation

rncl 0.2.0

  • initial release on CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.8.3 by Francois Michonneau, 6 months ago

Report a bug at

Browse source code at

Authors: Francois Michonneau [aut, cre] , Ben Bolker [aut] , Mark Holder [aut] , Paul Lewis [aut] , Brian O'Meara [aut]

Documentation:   PDF Manual  

Task views: Phylogenetics, Especially Comparative Methods

BSD_2_clause + file LICENSE license

Imports Rcpp, progress, stats

Suggests testthat, ape

Linking to Rcpp, progress

Imported by phylobase, rotl.

See at CRAN