by-split | R Documentation |
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.
split_by(data, formula, drop = TRUE)
splitBy(formula, data = parent.frame(), drop = TRUE)
## S3 method for class 'splitByData'
head(x, n = 6L, ...)
## S3 method for class 'splitByData'
tail(x, n = 6L, ...)
data |
A data frame |
formula |
Variables to split data frame by, as |
drop |
Logical indicating if levels that do not occur should be dropped. Deprecated; levels that do not occur are ignored. |
x |
An object. |
n |
A single integer. If positive or zero, size for the resulting object: number of elements for a vector (including lists), rows for a matrix or data frame or lines for a function. If negative, all but the "n" last/first number of elements of "x". |
... |
Arguments to be passed to or from other methods. |
A list of dataframes.
Søren Højsgaard, sorenh@math.aau.dk
orderBy
, order_by
,
summaryBy
, summary_by
,
transformBy
, transform_by
data(dietox, package="doBy")
splitBy(formula = ~Evit + Cu, data = dietox)
splitBy(formula = c("Evit", "Cu"), data = dietox)
splitBy(~Treatment + Type, data=CO2)
splitBy(c("Treatment", "Type"), data=CO2)
x <- splitBy(~Treatment, data=CO2)
head(x)
tail(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.