Annotate data frame with clusters
annotate_clusters(df,cluster_labels, long=TRUE, selected_clusters=NULL)a data frame
list of cluster labels, automatically converted to factor.
ifTRUE, returned data frame will be in long format. See details for spec. Default isTRUE.
optional cluster labels to filter
a wide or long data frame
Long data frame will have columns:Cluster,Measurement andValue.
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)#># A tibble: 6 × 3#> Cluster Measurement Value#><fct><chr><dbl>#>1 1 Petal.Length 1.4#>2 1 Sepal.Length 5.1#>3 1 Petal.Length 1.4#>4 1 Sepal.Length 4.9#>5 1 Petal.Length 1.3#>6 1 Sepal.Length 4.7