Perform clustering on the rows (usually cases) of a dataset.
Arguments
- x
Matrix, data.frame, or
ClusterConfigobject: Data to cluster (rows are cases to be clustered), or aClusterConfigrecipe (from setup_ClusterConfig) carrying the data path, algorithm config, and output directory.- algorithm
Character: Clustering algorithm.
- config
List: Algorithm-specific config.
- outdir
Character, optional: Output directory. If not NULL, the returned
Clusteringobject is saved there as an.rdsfile, alongside a run record (cluster_<algorithm>.record.json) stating what the run resolved. See write_record.- verbosity
Integer: Verbosity level.
Details
See docs.rtemis.org/r for detailed documentation.
Examples
iris_km <- cluster(exc(iris, "Species"), algorithm = "KMeans")
#> 2026-08-09 13:22:21
#> ▶
#> [cluster]
#> 2026-08-09 13:22:21
#> Input: 150 cases x 4 features.
#> [summarize_unsupervised]
#> 2026-08-09 13:22:21
#> Clustering with KMeans...
#> [cluster]
#> 2026-08-09 13:22:21
#> Checking unsupervised data...
#>
#> ✔
#> [check_unsupervised_data]
#> 2026-08-09 13:22:21
#> Clustering with KMeans ...
#> [cluster_]
#> 2026-08-09 13:22:21
#> Done in 0.06 seconds.
#> [cluster]