group_by {tidyft} | R Documentation |
Group by one or more variables
Description
Most data operations are done on groups defined by variables.
group_by
will group the data.table by selected variables (setting
them as keys), and arrange them in ascending order.
group_exe
could do computations by group, it receives an object
returned by group_by
.
Usage
group_by(.data, ...)
group_exe(.data, ...)
groups(x)
ungroup(x)
Arguments
.data |
A data.table |
... |
For |
x |
A data.table |
Details
For mutate
and summarise
, it is recommended to
use the innate "by" parameter, which is faster. Once the data.table is
grouped, the order is changed forever.
groups()
could return a character vector of specified groups.
ungroup()
would delete the keys in data.table.
Value
A data.table with keys
Examples
a = as.data.table(iris)
a
a %>%
group_by(Species) %>%
group_exe(
head(3)
)
groups(a)
ungroup(a)
groups(a)
[Package tidyft version 0.5.7 Index]