Learn R Programming

dendextend (version 0.14.2)

flip_leaves: Flip leaves

Description

Rotate a branch in a tree so that the locations of two bundles of leaves are flipped.

Usage

flip_leaves(dend, leaves1, leaves2, ...)

Arguments

dend
a dendrogram object
leaves1
a vector of leaves order value to flip.
leaves2
a (second) vector of leaves order value to flip.
...
not used

Value

  • A dendrogram object with flipped leaves.

Details

This function is based on a bunch of string manipulation functions. There may be a smarter/better way for doing it...

See Also

tanglegram, match_order_by_labels, entanglement.

Examples

Run this code
dend1 <- as.dendrogram(hclust(dist(USArrests[1:5,])))
dend2 <- flip_leaves(dend1, c(3,5), c(1,2))
tanglegram(dend1,dend2)
entanglement(dend1,dend2, L = 2) # 0.4

Run the code above in your browser using DataLab