View source: R/KmeansAutoElbow.R
KmeansQuick | R Documentation |
Perform quick kmeans algorithm for data clustering.
KmeansQuick(features, K)
features |
matrix of raw data (point by line). |
K |
number of clusters. |
KmeansQuick partition and K number of groups according to kmeans clustering
res.kmeans results obtained from kmeans algorithm.
KmeansAutoElbow
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
res <- KmeansQuick(dat, K=3)
plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y",
col = res$cluster, main = "K-means clustering")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.