data(iris) # data set
data <- iris
res <- kmeans(data[,1:4], normalize = FALSE, num.groups = 3)
message("R squared: ", res$R.sqt)
# message("Total sum of squares: ", res$sum.sqt)
message("Groups formed:"); res$groups
# message("Table with the results of the groups:"); res$res.groups
#write.table(file=file.path(tempdir(),"GroupData.csv"), res$groups, sep=";",
# dec=",",row.names = TRUE)
Run the code above in your browser using DataLab