Last chance! 50% off unlimited learning
Sale ends in
"label"
attribute for the leaves in a
dendrogram. These indices can then be used to access the appropriate
components of any additional data.order.dendrogram(x)## S3 method for class 'dendrogram':
labels(object, \dots)
as.dendrogram
).r <- order.dendrogram()
, each element is the
index into the original data (from which the dendrogram was computed).reorder
, dendrogram
.set.seed(123)
x <- rnorm(10)
hc <- hclust(dist(x))
hc$order
dd <- as.dendrogram(hc)
order.dendrogram(dd) ## the same :
stopifnot(hc$order == order.dendrogram(dd))
d2 <- as.dendrogram(hclust(dist(USArrests)))
labels(d2) ## in this case the same as
stopifnot(identical(labels(d2),
rownames(USArrests)[order.dendrogram(d2)]))
Run the code above in your browser using DataLab