`doHclust()` performs hierarchical clustering using a specified linkage method and returns both the full `hclust` object and the cluster labels obtained by cutting the dendrogram into `k` clusters.

This wrapper is used throughout PART to standardize calls to hierarchical clustering and ensure consistent linkage and cutting behavior.

doHclust(d, k, linkage)

Arguments

d

A distance object (typically produced by `dist()` or `getDist()`) representing pairwise distances between observations.

k

Integer specifying the number of clusters to extract from the dendrogram using `stats::cutree()`.

linkage

The hierarchical clustering linkage method. Must be a valid method for `stats::hclust()`, such as `"average"` (default in PART), `"ward.D2"`, `"complete"`, `"single"`, etc.