augment: Augment data with predictions

augment.cluster_fitR Documentation

Augment data with predictions

Description

augment() will add column(s) for predictions to the given data.

Usage

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

Arguments

x

A cluster_fit object produced by fit.cluster_spec() or fit_xy.cluster_spec() .

new_data

A data frame or matrix.

...

Not currently used.

Details

For partition models, a .pred_cluster column is added.

Value

A tibble::tibble() with containing new_data with columns added depending on the mode of the model.

Examples

kmeans_spec <- k_means(num_clusters = 5) %>%
  set_engine("stats")

kmeans_fit <- fit(kmeans_spec, ~., mtcars)

kmeans_fit %>%
  augment(new_data = mtcars)

tidyclust documentation built on Sept. 26, 2023, 1:08 a.m.