cluster | R Documentation |
Recodes the binary and row-stochastic membership matrix U into the classification variable (similar to the "cluster" output returned by kmeans()).
cluster(U)
U |
Binary and row-stochastic matrix. |
cl |
vector of length n indicating, for each element, the index of the cluster to which it has been assigned. |
Ionel Prunila, Maurizio Vichi
# Iris data
# Loading the numeric variables of iris data
iris <- as.matrix(iris[,-5])
# standardizing the data
iris <- scale(iris)
# double k-means with 3 unit-clusters and 2 components for the variables
p1 <- redkm(iris, K = 3, Q = 2)
cl <- cluster(p1$U)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.