-
Book Overview & Buying
-
Table Of Contents
R for Data Science
By :
K-means is the process of assigning objects to groups so that the sum of the squares of the groups is minimized. R has the kmeans function available for cluster analysis. K-means is a method of determining clusters based on partitioning the data and assigning items in the dataset to the nearest cluster.
K-means clustering is done in R using the kmeans function. The kmeans function is defined as follows:
kmeans(x, centers, iter.max = 10, nstart = 1,
algorithm = c("Hartigan-Wong", "Lloyd", "Forgy","MacQueen"), trace=FALSE)The various parameters of this function are described in the following table:
|
Parameter |
Description |
|---|---|
|
|
This is the dataset. |
|
|
This contains the number of centers/clusters to find. |
|
|
This stores the maximum number of iterations allowed. |
|
|
This contains the number of random clusters to find. |
|
|
This contains the algorithm to be used to determine clusters. |
Change the font size
Change margin width
Change background colour