Learn R Programming

dendextend (version 0.14.2)

get_branches_heights: Get height attributes from a dendrogram

Description

Get height attributes from a dendrogram

Usage

get_branches_heights(tree, sort = TRUE, decreasing = FALSE, ...)

Arguments

tree
a dendrogram.
sort
logical. Should the heights be sorted?
decreasing
logical. Should the sort be increasing or decreasing? Not available for partial sorting.
...
not used.

Value

  • a vector of the dendrogram's nodes heights (excluding leaves).

Examples

Run this code
hc <- hclust(dist(USArrests[1:4,]), "ave")
dend <- as.dendrogram(hc)
get_branches_heights(dend)

dat1 <- iris[1:150,-5]
dat1 <- rbind(dat1,dat1,dat1,dat1,dat1,dat1,dat1)
dend_big = as.dendrogram(hclust(dist(dat1)))
require(microbenchmark)
require(dendextendRcpp)
microbenchmark(dendextend_get_branches_heights(dend_big),
               get_branches_heights(dend_big),
               dendextendRcpp::get_branches_heights(dend_big),
               times = 10)
               # ~148 times faster! (for larger trees)

Run the code above in your browser using DataLab