Run the base
kmeans function with the specified number of centers within
1 2 3 4
An integer scalar specifying the number of centers. Alternatively, a function that takes the number of observations and returns the number of centers.
Further arguments to pass to
A numeric matrix-like object where rows represent observations and columns represent variables.
A KmeansParam object.
Logical scalar indicating whether the full k-means statistics should be returned.
This class usually requires the user to specify the number of clusters beforehand. However, we can also allow the number of clusters to vary as a function of the number of observations. The latter is occasionally useful, e.g., to allow the clustering to automatically become more granular for large datasets.
To modify an existing KmeansParam object
users can simply call
x[[i]] <- value where
i is any argument used in the constructor.
KmeansParam constructor will return a KmeansParam object with the specified parameters.
clusterRows method will return a factor of length equal to
nrow(x) containing the cluster assignments.
full=TRUE, a list is returned with
clusters (the factor, as above) and
the latter will contain the direct output of
kmeans, which actually does all the heavy lifting.
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.