This function takes a vector with cluster labels and sorts it by frequency such that the most frequent cluster is the first one and so on.
sort_clusters(clusters, map_subset = NULL)
A vector with cluster labels.
A logical vector of length equal to clusters
specifying
which elements of clusters
to use to determine the ranking of the clusters.
A factor of length equal to clusters
where the levels are the new
ordered clusters and the names of the factor are the original values from
clusters
.