group_by.dtplyr_step | R Documentation |
These are methods for dplyr's group_by()
and ungroup()
generics.
Grouping is translated to the either keyby
and by
argument of
[.data.table
depending on the value of the arrange
argument.
## S3 method for class 'dtplyr_step'
group_by(.data, ..., .add = FALSE, arrange = TRUE)
## S3 method for class 'dtplyr_step'
ungroup(x, ...)
.data |
A |
... |
In |
.add, add |
When This argument was previously called |
arrange |
If |
x |
A |
library(dplyr, warn.conflicts = FALSE)
dt <- lazy_dt(mtcars)
# group_by() is usually translated to `keyby` so that the groups
# are ordered in the output
dt %>%
group_by(cyl) %>%
summarise(mpg = mean(mpg))
# use `arrange = FALSE` to instead use `by` so the original order
# or groups is preserved
dt %>%
group_by(cyl, arrange = FALSE) %>%
summarise(mpg = mean(mpg))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.