as.phylo.dendrogram: Convert a dendrogram into phylo

Description Usage Arguments Value See Also Examples

View source: R/ape.R

Description

Based on as.hclust.dendrogram with as.phylo.hclust

In the future I hope a more direct link will be made.

Usage

1

Arguments

x

a dendrogram

...

ignored.

Value

A phylo class object

See Also

as.dendrogram, as.hclust, as.phylo

Examples

 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
## Not run: 

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

## End(Not run)


# see: https://github.com/klutometis/roxygen/issues/796
#

Example output

---------------------
Welcome to dendextend version 1.12.0
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package: 'dendextend'

The following object is masked from 'package:stats':

    cutree


Attaching package: 'ape'

The following objects are masked from 'package:dendextend':

    ladderize, rotate


Attaching package: 'ggdendro'

The following object is masked from 'package:dendextend':

    theme_dendro

Coordinate system already present. Adding new coordinate system, which will replace the existing one.

dendextend documentation built on May 9, 2021, 1:06 a.m.