Learn R Programming

DescTools (version 0.99.57)

split.formula: Formula Interface for Split

Description

Implementation of a simple formula interface for the split function.

Usage

# S3 method for 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

Andri Signorell <andri@signorell.net>

See Also

Examples

Run this code
split(extra ~ group, data = sleep)

Run the code above in your browser using DataLab