Description Usage Arguments Examples
The tagged function gains a parameter .by
, groups that existed before
are preserved. One can group by a computed variable, it will be kept if
named, dropped otherwise.
1 | grouping_by(.by)
|
.by |
variables to group by, either as a character vector or a call to
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
library(dplyr)
grouping_by$summarize(iris,meanSL = mean(Sepal.Length), .by="Species")
grouping_by(.by="Species")$summarize(iris,meanSL = mean(Sepal.Length))
grouping_by$summarize_all(iris, mean, .by="Species")
grouping_by$slice(iris,1, .by="Species")
# unnamed groupings are not kept
grouping_by$summarize(
iris,meanSW = mean(Sepal.Width), .by= vars(Species, Sepal.Width > 3.2))
# named groupings are kept
grouping_by$summarize(
iris,meanSW = mean(Sepal.Width), .by= vars(Species, long_sepal = Sepal.Width > 3.2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.