Learn R Programming

phylogram (version 2.0.1)

as.phylo.dendrogram: Convert dendrogram to "phylo" object.

Description

Functions for converting dendrograms to "phylo" objects and vice versa.

Usage

# S3 method for dendrogram
as.phylo(x, ...)

Arguments

x

a dendrogram object.

...

further arguments to be passed between methods.

Value

an object of class "phylo".

Details

These functions currently work by temporarily writing a tree to Newick text and then parsing the string using either read.dendrogram or read.tree. A faster implementation that avoids the transformation to text strings will be available in a future version.

Examples

Run this code
# NOT RUN {
  newick <- "(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);"
  x <- read.dendrogram(text = newick)
  y <- as.phylo(x)
  z <- as.dendrogram(y)
  identical(x, z)
# }

Run the code above in your browser using DataLab