
Finds a number of k-means clusting solutions using R's kmeans
function,
and selects as the final solution the one that has the minimum total
within-cluster sum of squared distances.
KMeans(x, centers, iter.max=10, num.seeds=10)
A list with components:
A vector of integers indicating the cluster to which each point is allocated.
A matrix of cluster centres (centroids).
The within-cluster sum of squares for each cluster.
The within-cluster sum of squares summed across clusters.
The between-cluster sum of squared distances.
The number of points in each cluster.
A numeric matrix of data, or an object that can be coerced to such a matrix (such as a numeric vector or a dataframe with all numeric columns).
The number of clusters in the solution.
The maximum number of iterations allowed.
The number of different starting random seeds to use. Each random seed results in a different k-means solution.
Dan Putler
data(USArrests)
KMeans(USArrests, centers=3, iter.max=5, num.seeds=5)
Run the code above in your browser using DataLab