if (FALSE) {
set.seed(23235)
ss <- sample(1:150, 10)
dend1 <- iris[ss, -5] %>%
dist() %>%
hclust("com") %>%
as.dendrogram()
dend2 <- iris[ss, -5] %>%
dist() %>%
hclust("single") %>%
as.dendrogram()
dend3 <- iris[ss, -5] %>%
dist() %>%
hclust("ave") %>%
as.dendrogram()
dend4 <- iris[ss, -5] %>%
dist() %>%
hclust("centroid") %>%
as.dendrogram()
# cutree(dend1)
all.equal(dend1, dend1)
all.equal(dend1, dend2)
all.equal(dend1, dend2, use.edge.length = FALSE)
all.equal(dend1, dend2, use.edge.length = FALSE, use.topology = FALSE)
all.equal(dend2, dend4, use.edge.length = TRUE)
all.equal(dend2, dend4, use.edge.length = FALSE)
all.equal(dendlist(dend1, dend2, dend3, dend4))
all.equal(dendlist(dend1, dend2, dend3, dend4), use.edge.length = FALSE)
all.equal(dendlist(dend1, dend1, dend1))
}
Run the code above in your browser using DataLab