View source: R/sort_clusters.R
sort_clusters | R Documentation |
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)
clusters |
A vector with cluster labels. |
map_subset |
A logical vector of length equal to |
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
.
## Build an initial set of cluster labels
clus <- letters[unlist(lapply(4:1, function(x) rep(x, x)))]
## In this case, it's a character vector
class(clus)
## Sort them and obtain a factor
sort_clusters(clus)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.