powered by

Implementation of a simple formula interface for the split function.

split

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

a formula of the form y ~ x.

y ~ x

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.

as.factor(f)

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

f

factor

the data frame from which the formula should be evaluated.

other arguments to be passed to split.

Andri Signorell <andri@signorell.net>

split(extra ~ group, data = sleep)

Run the code above in your browser using DataLab