order_tree {lazy.cluster} | R Documentation |
Order the Locations of the Bottom Level Clusters in a Tree
order_tree(tree)
tree |
An "hclust" object |
Algorithm found in below are used:
http://r.789695.n4.nabble.com/
Finding-an-order-for-an-hclust-dendrogram-object-without-intersections
-td2253471.html
# order can be calculated as follows
mto <- cutree( tree, k=1:nrow(tree$merge)+1 )
od <- order( mto[,2], mto[,3], ...,, mto[,ncol(mto)] )
Note that the order is NOT unique.
# exactly same testdata <- data.frame( y=c(1,2,4,19,12,15,6) ) reshc <- hclust( dist(testdata) ) plot( reshc ) order_tree( reshc ) # not the same but equivalent reshc <- hclust( dist(testdata), method="single" ) plot( reshc ) order_tree( reshc )