# Feeding R agnes object into cutree

I'm using agnes to group terms that frequently appear with one another in a set of documents. I get a dendrogram which verifies that things are working as expected. From this, I'd like to to retrieve the cluster of each member. I'm using cutree to cut the tree at a specified height, but it is returning one extra cluster, I'm not sure why.

length(flex75$order.lab) [1] 132 length(cutree(flex75, h = 1.5)) [1] 133 It occurs for varying heights, even up to h = max(flex75$height) and all clusters = 1. So I cannot bind the labels to their clusters.

EDIT:

I found the issue to be when I reorder flex75$height to be in ascending order (I was previously receiving an error that: the 'height' component of 'tree' is not sorted (increasingly)). I was also reordering the$order and $order.lab components using the$height order, and turns out that height is of length n-1 and order/order.lab is of length n.

My question now is: What is the relationship between the agnes object's $height vector, and the$order/\$order.lab vectors? Can I permute the heights, as I have, and feed that object into cutree? Should any of the object's other properties be correspondingly changed?