Partitions the rows of a data frame into evenly sized batches for chunked
processing (e.g. feeding a large source through np_run_batches() a chunk at
a time). Rows are shuffled first (deterministically, given seed) so each
batch is a representative slice rather than an accident of source ordering.
Arguments
- x
A data frame.
- size
Target rows per batch. Ignored if
nis supplied. Default 2500 — at the observed ~8% review rate this yields ~200 review cases per batch, one LLM-validation pass.- n
Number of batches. Overrides
sizewhen given.- shuffle
Shuffle rows before splitting. Default
TRUE.- seed
Optional RNG seed for reproducible shuffling. The global RNG state is saved and restored, so callers are unaffected.
Value
A list of data frames (the batches), with attribute n_batches.
An empty input returns an empty list.