Funkcja hclust() pobiera następujące parametry: d: macierz odległości – zwrócona przez funkcję dist(). method: Metoda połączenia używana do obliczania odległości między klastrami. Dozwolone wartości to: „Ward.D”, „Ward.D2”, „Single”, „Complete”, „average”, „mcquitty”, „median” lub „centroid”.

res.hc <- hclust(d = res.dist, method = "ward.D2") # cex: label size library("factoextra") fviz_dend(res.hc, cex = 0.5)

res.hc2 <- hclust(res.dist, method = "average") # Cut tree into 4 groups grp <- cutree(res.hc, k = 4)