3 \alias{as.phylo.hclust}
4 \alias{as.phylo.phylog}
5 \alias{as.hclust.phylo}
8 \title{Conversion Among Tree Objects}
11 \method{as.phylo}{hclust}(x, ...)
12 \method{as.phylo}{phylog}(x, ...)
13 \method{as.hclust}{phylo}(x, ...)
18 \item{x}{an object to be converted into another class.}
19 \item{...}{further arguments to be passed to or from other methods.}
20 \item{phy}{an object of class \code{"phylo"}.}
23 \code{as.phylo} is a generic function which converts an object into a
24 tree of class \code{"phylo"}. There are currently two methods for this
25 generic for objects of class \code{"hclust"} and of class
26 \code{"phylog"} (implemented in the package ade4).
27 \code{as.hclust.phylo} is a method of the generic
28 \code{\link[stats]{as.hclust}} which converts an object of class
29 \code{"phylo"} into one of class \code{"hclust"}. This can used to
30 convert an object of class \code{"phylo"} into one of class
31 \code{"dendrogram"} (see examples).
33 \code{old2new.phylo} and \code{new2old.phylo} are utility functions
34 for converting between the old and new coding of the class
38 An object of class \code{"hclust"} or \code{"phylo"}.
40 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
42 \code{\link[stats]{hclust}}, \code{\link[stats]{as.hclust}},
43 \code{\link[stats]{dendrogram}}, \code{\link[ade4]{phylog}},
44 \code{\link{as.phylo.formula}}
48 hc <- as.hclust(bird.orders)
50 identical(bird.orders, tr) # FALSE, but...
51 all.equal(bird.orders, tr) # ... TRUE
53 ### shows the three plots for tree objects:
54 dend <- as.dendrogram(hc)
55 layout(matrix(c(1:3, 3), 2, 2))
56 plot(bird.orders, font = 1)
58 par(mar = c(8, 0, 0, 0)) # leave space for the labels
61 ### how to get (nearly) identical plots with
62 ### plot.phylo and plot.dendrogram:
63 layout(matrix(1:2, 2, 1))
64 plot(bird.orders, font = 1, no.margin = TRUE)
65 par(mar = c(0, 0, 0, 8))
66 plot((dend), horiz = TRUE)
67 layout(matrix(1, 1, 1))