clusterOptimalK: Visualize K-Means Clusters for Several K Methods

clusterOptimalKR Documentation

Visualize K-Means Clusters for Several K Methods

Description

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

Other Clusters: clusterKmeans(), clusterVisualK(), reduce_pca(), reduce_tsne()

Examples

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

## End(Not run)

lares documentation built on Sept. 13, 2024, 1:08 a.m.