doBy (version 4.5-15)

splitBy: Split a data frame

Description

Split a dataframe according to the levels of variables in the dataframe. The variables to split by can be given as a formula or as a character vector.

Usage

splitBy(formula, data = parent.frame(), drop=TRUE)

Arguments

formula
The right hand side of a formula (or a character vector)
data
A data frame
drop
Logical indicating if levels that do not occur should be dropped
...
Additional arguments, currently not used.

Value

A list of dataframes.

See Also

orderBy, summaryBy, transformBy, lapplyBy, scaleBy

Examples

Run this code
data(dietox, package="doBy")
splitBy(formula = ~Evit+Cu, data = dietox)
splitBy(formula = c("Evit","Cu"), data = dietox)

splitBy(~Month, data=airquality)
splitBy("Month", data=airquality)

Run the code above in your browser using DataLab