View source: R/utils_clustering.R
annotate_clusters | R Documentation |
Annotate data frame with clusters
annotate_clusters(df, cluster_labels, long = TRUE, selected_clusters = NULL)
df |
a data frame |
cluster_labels |
list of cluster labels, automatically converted to factor. |
long |
if |
selected_clusters |
optional cluster labels to filter |
Long data frame will have columns: Cluster
, Measurement
and Value
.
a wide or long data frame
dmat <- compute_dmat(iris, "euclidean", TRUE, c("Petal.Length", "Sepal.Length"))
res <- compute_clusters(dmat, "complete")
cluster_labels <- cut_clusters(res, 2)
annotated_data <- annotate_clusters(iris[, c("Petal.Length", "Sepal.Length")], cluster_labels)
head(annotated_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.