kmeansCluster {Evacluster} | R Documentation |
This function classifies unlabeled data by grouping them by features, rather than pre-defined categories. It splits the data into K different clusters and describes the location of the center of each cluster. Then, a new data point can be assigned a cluster (class) based on the closed center of mass.
kmeansCluster(data = NULL, ...)
data |
A Data set |
... |
center: The number of centers |
A list of cluster labels and a R object of class "kmeans"
library(datasets)
data(iris)
rndSamples <- sample(nrow(iris),100)
trainData <- iris[rndSamples,]
testData <- iris[-rndSamples,]
cls <- kmeansCluster(trainData[,1:4],3)