as.phylo {ape} | R Documentation |
The function as.phylo.hclust
(short form as.phylo
)
converts a clustering tree computed using hclust
into a
phylogenetic tree, i.e. into an object of class "phylo"
.
The function as.hclust.phylo
(short form as.hclust
)
converts a phylogenetic tree into a "hclust"
object.
as.phylo(hc) as.phylo.hclust(hc) as.hclust.phylo(x, ...)
hc |
an object of class "hclust" ), i.e. a clustering tree
computed using hclust . |
x |
a phylogenetic tree, i.e. an object of class "phy" . To
be converted into a "hclust" object the phylogenetic tree
needs to be ultra-metric and binary. |
... |
further arguments to be passed to or from other methods. |
An object of class "hclust"
or "phylo"
, respectively.
Gangolf Jobb (http://www.treefinder.de)
hclust
, as.hclust
,
is.binary.tree
, is.ultrametric
library(ape) library(stats) # for hclust and example data set # create hclust object data(USArrests) hclust.tree<-hclust(dist(USArrests[1:6,])) plot(hclust.tree) # convert into phylo object phylo.tree <- as.phylo(hclust.tree) phylo.tree plot(phylo.tree) # phylogenetic tree is ultrametric and binary is.ultrametric(phylo.tree) is.binary.tree(phylo.tree) # convert back into hclust object converted.tree <- as.hclust(phylo.tree) plot(converted.tree)