Match clusters to true clusters

match_clusters(data, res, nclust)

Arguments

data

data frame with 'id' and 'true_clust' columns

res

a clustering result that has a 'clust' tibble with 'id' and 'clust' columns (e.g. attach res$clust <- tibble(id = ..., clust = ...) to a stats::kmeans result; for TGL_kmeans_tidy output the 'cluster' tibble is matched by partial name)

nclust

number of clusters

Value

data frame with matched clusters