partition: Split a dataset into training and held-out test partitions

View source: R/048_PartitionConfig.R

partitionR Documentation

Split a dataset into training and held-out test partitions

Description

A held-out split is a decision – which rows train, which are held out, and by what rule – and a decision the record cannot report is one nothing downstream can audit. partition() makes it a first-class, executed step, the same way ingest() makes reading a file one: the config states the rule, this function applies it and returns a manifest naming exactly what happened, including a DataFingerprint of each side.

Not a SuperConfig property. SuperConfig's dat_training_path and dat_test_path simply name whatever partition() (or any other step) produced – the same relationship they already have with ingest()'s output.

Usage

partition(dat, config, outdir = NULL, overwrite = FALSE, verbosity = 1L)

Arguments

dat

data.frame or data.table: The dataset to split.

config

PartitionConfig: The split rule.

outdir

Optional Character: Directory to write training.parquet and test.parquet to; created if it does not exist. If NULL, nothing is written and each outputs entry carries its fingerprint and row count without a path.

overwrite

Logical: If TRUE, overwrite existing output files.

verbosity

Integer: Verbosity level.

Value

Named list: the partition manifest – config, source (a DataFingerprint of dat), and outputs (a list with training and test, each holding a fingerprint and, when outdir is given, the path written to).

Author(s)

EDG

Examples

partition(iris, setup_RandomPartition(train_p = 0.8, seed = 2026L))

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