R: Split a data frame

splitBy {doBy} | R Documentation

## 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.

### Author(s)

Søren Højsgaard, sorenh@math.aau.dk

### See Also

`orderBy`, `summaryBy`, `transformBy`, `lapplyBy`, `scaleBy`

### Examples

    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)

[Package doBy version 4.5-15 Index]