Generally, leaves order value should be a sequence of integer values. From 1 to nleaves(dend). This function fixes trees by using rank on existing leaves order values.

rank_order.dendrogram(dend, ...)

Arguments

dend

a dendrogram object

...

not used

Value

A dendrogram, after fixing its leaves order values.

See also

Examples


# define dendrogram object to play with:
dend <- USArrests[1:4, ] %>%
  dist() %>%
  hclust(method = "ave") %>%
  as.dendrogram()
# plot(dend)
order.dendrogram(dend)
#> [1] 4 3 1 2
dend2 <- prune(dend, "Alaska")
order.dendrogram(dend2)
#> [1] 3 2 1
order.dendrogram(rank_order.dendrogram(dend2))
#> [1] 3 2 1