# KMeans

From Rcmdr v1.7-2
by John Fox

##### K-Means Clustering Using Multiple Random Seeds

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.

- Keywords
- misc

##### Usage

`KMeans(x, centers, iter.max=10, num.seeds=10)`

##### Arguments

- x
- 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).
- centers
- The number of clusters in the solution.
- iter.max
- The maximum number of iterations allowed.
- num.seeds
- The number of different starting random seeds to use. Each random seed results in a different k-means solution.

##### Value

- A list with components:
cluster A vector of integers indicating the cluster to which each point is allocated. centers A matrix of cluster centres (centroids). withinss The within-cluster sum of squares for each cluster. tot.withinss The within-cluster sum of squares summed across clusters. betweenss The between-cluster sum of squared distances. size The number of points in each cluster.

##### See Also

##### Examples

```
data(USArrests)
KMeans(USArrests, centers=3, iter.max=5, num.seeds=5)
```

*Documentation reproduced from package Rcmdr, version 1.7-2, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.