split: Split a table by groups

View source: R/split.R

splitR Documentation

Split a table by groups

Description

Split a table into pieces by one or more grouping columns. When data is not a data frame, dispatches to base::split() so the classic split(vector, factor) idiom keeps working with basetable attached.

Usage

split(data, by, drop = FALSE, keep.by = TRUE)

Arguments

data

A data frame or data table, or an atomic vector.

by

For a data frame, a character vector of grouping columns. For an atomic vector, a factor (or object coercible to one) the same length as data, as in base::split().

drop

Whether to drop empty groups.

keep.by

Whether to keep grouping columns in each piece. Ignored when data is not a data frame.

Value

A named list of basetables (data frame input) or a named list of vectors (atomic vector input, matching base::split()).


basetable documentation built on Sept. 18, 2026, 9:13 a.m.