I have a dendrogram and I would like to extract all the lables under a node that I already know its height. For example:
data = data.frame(point = c('A','B','C','D','E'),
x = c(2,2.5,2.1,3,5),
y = c(3.1,4,5,6,2))
d = dist(as.matrix(data[, 2:3]))
hc = hclust(d,method = "ward.D2")
plot(hc, labels = data$point)
And we know the height of the all the nodes:
hc$height
# [1] 1.029563 1.345362 2.790161 4.584430
Now I would like to know all labels under a certain height, for example, with the height equals to 1.029563, I expect the results c("A", "B")
and with the height equals to 1.345362, I expect the results c("C", "D")
.
Can someone help, please?