dendextendRcpp (version 0.6.1)

dendextendRcpp_get_branches_heights: Get branches height attr from a dendrogram

Description

Get branches height attributes from a dendrogram.

This function is intended to override get_branches_heights. Since it is 40-100 times faster.

Usage

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

Arguments

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

Value

A numeric vector of the dendrogram's nodes heights (excluding leaves).

See Also

labels, dendrogram, attr

Examples

Run this code
## Not run: 
# dend = as.dendrogram(hclust(dist(iris[1:150,-5])))
# plot(dend)
# get_height(dend)
# 
# 
# attributes(dend) <- NULL
# Rcpp_get_dend_heights(dend) # knows to through a warning :)
# 
# dend = as.dendrogram(hclust(dist(iris[1:150,-5])))
# Rcpp_get_dend_heights(dend)
# get_branches_heights(dend)
# Rcpp_get_dend_heights(dend,T,F)
# Rcpp_get_dend_heights(dend,T,F)
# 
# # require(dendextend)
# Rcpp_get_dend_heights(dend)
# dendextendRcpp_get_branches_heights(dend,sort=F)
# 
# \dontrun{
# require(microbenchmark)
# microbenchmark(
#    dendextendRcpp::dendextendRcpp_get_branches_heights(dend),
#    old_get_branches_heights(dend,sort=F)
# )
# # Rcpp is about 40-107 times faster!
# }
# ## End(Not run)

Run the code above in your browser using DataLab