Description Usage Arguments Examples
A tool to aid in the implementation of conventional k means clustering, kmeansPlus() provides the normal functionality of stats::kmeans() with some modest additions. In short, it allows the user to quickly plot results from kmeans(), as well as add cluster identifiers to the input dataframe as a new variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
data |
A matrix or dataframe containing numeric data in tidy format. This is equivalent to the 'x' argument from kmeans(). |
k |
Either the desired number of clusters, or a set of initial (distinct) cluster centers. This is equivalent to the 'centers' argument from kmeans(). |
exclude |
A vector, either numeric or character, indicating either indices or colnames of variables in 'data' that the user wishes to exclude. The excluded variable will not be removed from the tibble printed in the final output (when full.output and plot are set to FALSE), but it will be excluded from all clustering and vizualisation procedures. |
full.output |
A logical vector indicating whether the output of kmeansPlus() should include the full output of kmeans(). |
plot |
A logical vector indicating whether the output of kmeansPlus() should include a plot. |
x |
A string (character vector of length 1) containing the colname of a variable from 'data' to be plotted on the x axis (if plot = TRUE). |
y |
A string (character vector of length 1) containing the colname of a variable from 'data' to be plotted on the y axis (if plot = TRUE). |
iter.max |
This is equivalent to the 'iter.max' argument from kmeans(), and is set to the same default. |
nstart |
This is equivalent to the 'nstart' argument from kmeans(), and is set to the same default. |
algorithm |
This is equivalent to the 'algorithm' argument from kmeans(), and is set to the same default. |
trace |
This is equivalent to the 'trace' argument from kmeans(), and is set to the same default. |
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.