R: Finds subsets of a dataframe which is split by variables in a...

by-subset {doBy} | R Documentation

## Finds subsets of a dataframe which is split by variables in a formula.

### Description

A data frame is split by a formula into groups. Then subsets are found within each group, and the result is collected into a data frame.

### Usage

    subsetBy(
      formula,
      subset,
      data = parent.frame(),
      select,
      drop = FALSE,
      join = TRUE,
      ...
    )

### Arguments

`formula` | A right hand sided formula or a character vector of variables to split by.
`subset` | logical expression indicating elements or rows to keep: missing values are taken as false.
`data` | A data frame.
`select` | expression, indicating columns to select from a data frame.
`drop` | passed on to `[` indexing operator.
`join` | If FALSE the result is a list of data frames (as defined by 'formula'); if TRUE one data frame is returned.
`...` | further arguments to be passed to or from other methods.

### Value

A data frame.

### Author(s)

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

### See Also

`splitBy`

### Examples

    data(dietox)
    subsetBy(~Evit, Weight < mean(Weight), data=dietox)

[Package doBy version 4.6.5 Index]