by-subset | R Documentation |
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.
subset_by(data, formula, subset, select, drop = FALSE, join = TRUE, ...)
subsetBy(
formula,
subset,
data = parent.frame(),
select,
drop = FALSE,
join = TRUE,
...
)
data |
A data frame. |
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. |
select |
expression, indicating columns to select from a data frame. |
drop |
passed on to |
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. |
A data frame.
Søren Højsgaard, sorenh@math.aau.dk
splitBy
, split_by
data(dietox)
subsetBy(~Evit, Weight < mean(Weight), data=dietox)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.