tidy.cluster_fit: Turn a tidyclust model object into a tidy tibble

View source: R/tidy.R

tidy.cluster_fitR Documentation

Turn a tidyclust model object into a tidy tibble

Description

This method tidies the model in a tidyclust model object, if it exists.

Usage

## S3 method for class 'cluster_fit'
tidy(x, ...)

Arguments

x

An object to be converted into a tidy tibble::tibble().

...

Additional arguments to tidying method.

Value

A tibble with one row per cluster. Columns depend on the underlying engine but typically include .cluster and cluster-level summary statistics such as centroid coordinates or cluster size.

Examples

# tidy() support depends on the underlying engine. For the stats engine,
# broom must be installed.
## Not run: 
kmeans_fit <- k_means(num_clusters = 3) |>
  set_engine("stats") |>
  fit(~., mtcars)

tidy(kmeans_fit)

hclust_fit <- hier_clust(num_clusters = 3) |>
  set_engine("stats") |>
  fit(~., mtcars)

tidy(hclust_fit)

## End(Not run)

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