rank_branches: Rank branches' heights

Description Usage Arguments Value See Also Examples

View source: R/attr_access.R

Description

Adjust the height attr in all of the dendrogram nodes so that the tree will have a distance of 1 unit between each parent/child nodes. It can be thought of as ranking the branches between themselves.

This is intended for easier comparison of the topology of two trees.

Notice that this function changes the height of all the leaves into 0, thus erasing the effect of hang.dendrogram (which should be run again, if that is the visualization you are intereted in).

Usage

1
rank_branches(dend, diff_height = 1, ...)

Arguments

dend

a dendrogram object

diff_height

Numeric scalar (1). Affects the difference in height between two branches.

...

not used

Value

A dendrogram, after adjusting the height attr in all of its branches.

See Also

get_branches_heights, get_childrens_heights, hang.dendrogram, tanglegram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# define dendrogram object to play with:
dend <- USArrests[1:5, ] %>%
  dist() %>%
  hclust() %>%
  as.dendrogram()

par(mfrow = c(1, 3))

plot(dend)
plot(rank_branches(dend))
plot(hang.dendrogram(rank_branches(dend)))

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