dend <- iris[, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram()
dend_k <- find_k(dend)
plot(dend_k)
plot(color_branches(dend, k = dend_k$nc))
library(cluster)
sil <- silhouette(dend_k$pamobject)
plot(sil)
dend <- USArrests %>%
dist() %>%
hclust(method = "ave") %>%
as.dendrogram()
dend_k <- find_k(dend)
plot(dend_k)
plot(color_branches(dend, k = dend_k$nc))
Run the code above in your browser using DataLab