Performs PAM clustering with tidy output
Arguments
- data
A data frame, tibble, or dist object
- k
Number of clusters
- metric
Distance metric (default: "euclidean"). Use "gower" for mixed data types.
- cols
Columns to include (tidy select). If NULL, uses all columns.
- ...
Further arguments passed to
pam, such asnstart,variantor startingmedoids.cluster.only = TRUEanddissare refused, under any abbreviation R would accept: the first leaves no fit to build the result from, and tidy_pam() sets the second itself fromdata.
Value
A list of class "tidy_pam" containing:
clusters: tibble with observation IDs and cluster assignments
medoids: tibble with one row per cluster: the medoid's row position in the data (
medoid_index, an integer) and, unlessdatawas a dist object, its valuessilhouette_avg: average silhouette width
silhouette_data: the silhouette information
pam()returns (itssilinfo)model: original pam object
