Description Usage Arguments Value Author(s) Examples
A convenient wrapper for factoextra::fviz_nbclust
, which plot within cluster sums of squares, average silhouette and gap statistics for clustering.
The required parameters and their corresponding documentations are simplified versions of that in factoextra::fviz_nbclust
.
1 2 3 4 5 6 7 | cluster.elbow(
dat,
FUNcluster,
method = c("wss", "silhouette", "gap_stat"),
k.max = 10,
...
)
|
dat |
an input data. |
FUNcluster |
a partitioning function which accepts as first argument a (data) matrix like x, second argument, say k, k >= 2, the number of clusters desired, and returns a list with a component named cluster which contains the grouping of observations. By default, "kmeans". |
method |
the method to be used for estimating the optimal number of clusters. Possible values are "silhouette" (for average silhouette width), "wss" (for total within sum of square) and "gap_stat" (for gap statistics). |
k.max |
the maximum number of clusters to consider. By default, 10. |
... |
optional arguments. See or directly use |
cluster.elbow
returns a ggplot2 object.
Neo Christopher Chung nchchung@gmail.com
1 2 3 4 5 | ## Not run:
data(coptm)
cluster.elbow(dat=optm, FUNcluster=kmeans, method="wss", k.max=10, linecolor="black")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.