cluster_pam.Rdcluster::clusGap() cannot be used here for distance matrix, so
it is removed.
cluster_pam_estimate( x, method = c("silhouette", "wss"), k.max = 10, verbose = interactive(), barfill = "steelblue", barcolor = "steelblue", linecolor = "steelblue", FUNcluster = cluster::pam, seed = 1234L, ... ) cluster_pam(x, k, ...)
| x | a dissimilarity matrix. |
|---|---|
| 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, must be at least two. |
| verbose | logical value. If TRUE, the result of progress is printed. |
| barfill | fill color and outline color for bars |
| barcolor | fill color and outline color for bars |
| linecolor | color for lines |
| 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. Allowed values include: kmeans,
cluster::pam, cluster::clara, cluster::fanny, hcut, etc. This argument is
not required when x is an output of the function
|
| seed | random seed. |
| ... | other parameters passing to cluster::pam. |
| k | positive integer specifying the number of clusters, less than the number of observations. |
a ggplot object.
a PAM clustering result object.
data("iris") head(iris) iris.scaled <- scale(iris[, -5]) iris.dist <- dist(iris.scaled) %>% as.matrix() p <- cluster_pam_estimate(iris.dist) p2 <- cluster_pam_estimate(iris.dist, method = "wss") cl <- cluster_pam(iris.dist, 3)