Pieter van der Spek
2009-May-20 14:57 UTC
[R] meaning of order-vector in object of class hclust
I'm trying to export the dendrogram created in R such that I can rebuild it inside an other program. However, I don't fully understand the relation between the merge, height and order vectors. This is what I do grasp. The merge-matrix shows how the original observations were merged into a tree structure. The height-vector contains the heights for each of the nodes in the tree. The order of the merge-matrix and the height-vector is the same. This means that row *i* in the matrix corresponds to row *i* in the vector. Then there is the order-vector. The documentation describes it as follows: order a vector giving the permutation of the original observations suitable for plotting, in the sense that a cluster plot using this ordering and matrix merge will not have crossings of the branches. So far, I get it reorders the nodes to prevent overlapping branches, but I don't understand how the values in this vector correspond to the values in the other two structures. So what does row *i* in the order-vector say about the other structures? Should I reorder the merge-matrix and height-vector, according to the values in the order-vector, before constructing the tree? Hopefully someone can explain to me how this works. Thanks in advance for any help you can provide. Kind regards, Pieter [[alternative HTML version deleted]]