Learn R Programming

parameters (version 0.6.0)

n_clusters: Number of clusters to extract

Description

This function runs many existing procedures for determining how many clusters are present in your data. It returns the number of clusters based on the maximum consensus. In case of ties, it will select the solution with the less clusters.

Usage

n_clusters(
  x,
  standardize = TRUE,
  force = FALSE,
  package = c("NbClust", "mclust", "cluster", "M3C"),
  fast = TRUE,
  ...
)

Arguments

x

A data frame.

standardize

Standardize the dataframe before clustering (default).

force

Logical, if TRUE, factors are converted to numerical values in order to be included in the data for determining the number of clusters. By default, factors are removed, because most methods that determine the number of clusters need numeric input only.

package

These are the packages from which methods are used to determine the number of clusters. Can be "all" or a vector containing "NbClust", "mclust", "cluster" and "M3C".

fast

If FALSE, will compute 4 more indices (sets index = "allong" in NbClust). This has been deactivated by default as it is computationally heavy.

...

Arguments passed to or from other methods.

Examples

Run this code
# NOT RUN {
library(parameters)
# }
# NOT RUN {
n_clusters(iris[, 1:4], package = c("NbClust", "mclust", "cluster"))
# }

Run the code above in your browser using DataLab