`findPartition()` computes cluster assignments for a sequence of cluster counts `k = 1, …, Kmax` using either hierarchical clustering or k-means, depending on the method specified in the `...` argument list.

For hierarchical clustering, a distance matrix is computed (unless provided), and `cutree()` is applied at each level `k`. For k-means, the algorithm is run independently for each `k`, using Euclidean distance.

The function returns a list where each element `cl.lab[[k]]` contains a vector of cluster labels corresponding to the partition with `k` clusters.

findPartition(X, Kmax, dX = NULL, ...)

Arguments

X

A numeric data matrix where rows correspond to observations and columns to features. Used directly for k-means and for computing distances when needed.

Kmax

Maximum number of clusters to generate. Partitions for all `k` from `1` to `Kmax` are returned.

dX

Optional precomputed distance object. If `NULL` and the clustering method is hierarchical (`"hclust"`), the distance matrix is computed internally using `getDist()`. Ignored when `cl.method = "kmeans"`.

...

Additional parameters passed from higher-level PART functions, provided as a list (typically `fixed.par`). Relevant values include `cl.method`, `linkage`, `nstart`, `dist.method`, and `cor.method`.

Value

list of cluster labels