Movatterモバイル変換


[0]ホーム

URL:


visxhclust1.1.0

Annotate data frame with clusters

Source:R/utils_clustering.R
annotate_clusters.Rd

Annotate data frame with clusters

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

ifTRUE, returned data frame will be in long format. See details for spec. Default isTRUE.

selected_clusters

optional cluster labels to filter

Value

a wide or long data frame

Details

Long data frame will have columns:Cluster,Measurement andValue.

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)#># 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

[8]ページ先頭

©2009-2025 Movatter.jp