annotate_clusters: Annotate data frame with clusters

View source: R/utils_clustering.R

annotate_clustersR Documentation

Annotate data frame with clusters

Description

Annotate data frame with clusters

Usage

annotate_clusters(df, cluster_labels, long = TRUE, selected_clusters = NULL)

Arguments

df

a data frame

cluster_labels

list of cluster labels, automatically converted to factor.

long

if TRUE, returned data frame will be in long format. See details for spec. Default is TRUE.

selected_clusters

optional cluster labels to filter

Details

Long data frame will have columns: Cluster, Measurement and Value.

Value

a wide or long data frame

Examples

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)

visxhclust documentation built on March 31, 2023, 7:30 p.m.