Cut a hierarchical tree targeting k clusters
cut_clusters(clusters, k)
cluster results, produced by e.g. fastcluster::hclust()
target number of clusters
cluster labels
dmat <- compute_dmat(iris, "euclidean", TRUE, c("Petal.Length", "Sepal.Length"))
clusters <- compute_clusters(dmat, "complete")
cluster_labels <- cut_clusters(clusters, 2)
head(cluster_labels)
#> [1] 1 1 1 1 1 1