cluster: Perform Clustering

View source: R/cluster.R

clusterR Documentation

Perform Clustering

Description

Perform clustering on the rows (usually cases) of a dataset.

Usage

cluster(
  x,
  algorithm = "KMeans",
  config = NULL,
  execution_config = setup_FutureExecution(),
  outdir = NULL,
  verbosity = 1L
)

Arguments

x

Matrix, data.frame, or ClusterConfig object: Data to cluster (rows are cases to be clustered), or a ClusterConfig recipe (from setup_ClusterConfig) carrying the data path, algorithm config, and output directory.

algorithm

Character: Clustering algorithm. Not needed when config is supplied, which names its own; an explicit algorithm that disagrees with config is an error.

config

ClusteringConfig, optional: Algorithm-specific config from a clustering ⁠setup_*⁠ function. Its features selects the columns to cluster on; NULL selects every numeric column of x, since a clustering backend reads numbers. The returned object's config carries the resolved names.

execution_config

ExecutionConfig object: Execution settings, e.g. setup_FutureExecution or setup_SerialExecution. A clustering dispatches no work to other processes and no registered algorithm threads, so the fit runs on one thread; the config's seed seeds it.

outdir

Character, optional: Output directory. If not NULL, the returned Clustering object is saved there as an .rds file, 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.

Value

Clustering object.

Author(s)

EDG

Examples

iris_km <- cluster(exc(iris, "Species"), algorithm = "KMeans")

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.