tidyclust-package: tidyclust: A Tidy Interface to Clustering

tidyclust-packageR Documentation

tidyclust: A Tidy Interface to Clustering

Description

The tidyclust package provides a tidy, unified interface to clustering models, following the same design patterns as parsnip. It creates a consistent API across different clustering functions and engines.

Details

Model specifications

  • k_means(): K-means clustering (stats, ClusterR, klaR, clustMixType engines)

  • hier_clust(): Hierarchical/agglomerative clustering (stats engine)

  • db_clust(): Density-based clustering (dbscan engine)

  • gm_clust(): Gaussian mixture model clustering (mclust engine)

Key functions

  • Fitting: fit(), fit_xy()

  • Prediction: predict.cluster_fit()

  • Extraction: extract_centroids(), extract_cluster_assignment()

  • Metrics: silhouette_avg(), sse_within_total(), sse_ratio()

  • Tuning: tune_cluster()

Getting started

# Create a specification
spec <- k_means(num_clusters = 3)

# Fit to data
fit <- fit(spec, ~., data = mtcars)

# Extract results
extract_centroids(fit)
extract_cluster_assignment(fit)

Author(s)

Maintainer: Emil Hvitfeldt emil.hvitfeldt@posit.co (ORCID)

Authors:

Other contributors:

  • Posit Software, PBC (ROR) [copyright holder, funder]

See Also


tidyclust documentation built on June 20, 2026, 9:08 a.m.