结果包含:
$names
[1] "cluster" "centers" "totss""withinss"
[5] "tot.withinss" "betweenss""size" "iter"
[9] "ifault"
$class
[1] "kmeans"
想看类中心,就用:
res$centers
想看结果:
res$cluster
其他的结果查看是同样道理。
kmeans文档中时这样写的:Description
Perform k-means clustering on a data matrix.
Usage
kmeans(x, centers, iter.max = 10, nstart = 1, algorithm = c("Hartigan-Wong", "Lloyd", "Forgy",
"MacQueen"), trace=FALSE)
所以,默认的最大迭代次数是10,当然我们使用的时候自己来设置!一般10、30、50都行吧!