dend = as.dendrogram(hclust(dist(iris[1:4,-5])))
# this is really cool!
cut_lower_fun(dend, .4, labels)
lapply(cut(dend, h = .4)$lower, labels)
cut_lower_fun(dend, .4, order.dendrogram)
require(dendextend)
require(dendextendRcpp)
dend_big = as.dendrogram(hclust(dist(iris[1:150,-5])))
require(microbenchmark)
microbenchmark(old_cut_lower_fun(dend_big,4),
dendextendRcpp::cut_lower_fun(dend_big,4),
times = 100)
# about 20 times faster. It is faster the larger the tree is.Run the code above in your browser using DataLab