File: as.phylo.dendrogram.Rd

package info (click to toggle)
r-cran-dendextend 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,888 kB
  • sloc: sh: 13; makefile: 2
file content (59 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ape.R
\name{as.phylo.dendrogram}
\alias{as.phylo.dendrogram}
\title{Convert a dendrogram into phylo}
\usage{
as.phylo.dendrogram(x, ...)
}
\arguments{
\item{x}{a dendrogram}

\item{...}{ignored.}
}
\value{
A phylo class object
}
\description{
Based on \link{as.hclust.dendrogram} with \link[ape]{as.phylo.hclust}

In the future I hope a more direct link will be made.
}
\examples{
\dontrun{

library(dendextend)
library(ape)
dend <- iris[1:30, -5] \%>\%
  dist() \%>\%
  hclust() \%>\%
  as.dendrogram()
dend2 <- as.phylo(dend)
plot(dend2, type = "fan")


# Also possible to with ggplot2 :)

library(dendextend)
library(ggplot2)
library(ggdendro)
dend <- iris[1:30, -5] \%>\%
  dist() \%>\%
  hclust() \%>\%
  as.dendrogram()
# Rectangular lines
ddata <- dend \%>\% dendro_data(type = "rectangle")
p <- ggplot(segment(ddata)) +
  geom_segment(aes(x = x, y = y, xend = xend, yend = yend)) +
  coord_flip() +
  scale_y_reverse(expand = c(0.2, 0)) + coord_polar(theta = "x")
p
}


# see: https://github.com/klutometis/roxygen/issues/796
#
}
\seealso{
\link{as.dendrogram}, \link{as.hclust}, \link[ape]{as.phylo}
}