Maps a vector of cluster numbers to another categorical vector,
yielding a new vector of matching cluster numbers. Useful for distributing
cluster numbers back out to the original observations in cases where the
clustering was performed on a table of unique levels rather than directly
on the observations (such as with
a factor or character vector representing a categorical variable
a named numeric vector of cluster numbers, such as an
object returned by
a boolean controlling the behavior when a value in
Any categories in
x that do not exist in
are given a cluster of
NA, or (if
assigned the cluster number that is most-frequently used for the other
existing categories, with ties going to the lowest cluster number. If
there are no matching clusters for any of the categories in
imputation will simply use the first cluster number in
If there are duplicate names in
clusters, the first occurrence
A factor vector of the same length as
assigned cluster numbers.
1 2 3 4 5 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.