Skip to contents

Visualize cluster data for assorted values of k and methods such as WSS, Silhouette and Gap Statistic. See factoextra::fviz_nbclust for more.

Usage

clusterOptimalK(
  df,
  method = c("wss", "silhouette", "gap_stat"),
  drop_na = TRUE,
  ohse = TRUE,
  norm = TRUE,
  quiet = TRUE,
  ...
)

Arguments

df

Dataframe

method

Character vector.

drop_na

Boolean. Should NA rows be removed?

ohse

Boolean. Do you wish to automatically run one hot encoding to non-numerical columns?

norm

Boolean. Should the data be normalized?

quiet

Boolean. Keep quiet? If not, print messages.

...

Additional parameters passed to factoextra::fviz_nbclust

Value

Plot. Optimal number of clusters of df data.frame given a selected method.

See also

Examples

# You must have "factoextra" library to use this auxiliary function:
if (FALSE) {
data("iris")
df <- subset(iris, select = c(-Species))
# Calculate and plot optimal k clusters
clusterOptimalK(df)
}