split.formula: Formula Interface for Split

View source: R/DescTools.r

split.formulaR Documentation

Formula Interface for Split

Description

Implementation of a simple formula interface for the split function.

Usage

## S3 method for class 'formula'
 split(x, f, drop = FALSE, data = NULL, ...)

Arguments

x

a formula of the form y ~ x.

f

a 'factor' in the sense that as.factor(f) defines the grouping, or a list of such factors in which case their interaction is used for the grouping.

drop

logical indicating if levels that do not occur should be dropped (if f is a factor or a list). Defaults to FALSE.

data

the data frame from which the formula should be evaluated.

...

other arguments to be passed to split.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

split

Examples

split(extra ~ group, data = sleep)

DescTools documentation built on Nov. 20, 2023, 5:08 p.m.