View source: R/standalone-tidy-utils.R
intersecting_group_by | R Documentation |
Create a new data frame including duplicate rows where the rows fulfil a potentially overlapping set of conditions specified as named predicates (as formulae)
intersecting_group_by(.data, ..., .colname)
.data |
a data frame |
... |
a set of predicates specified like case_whens syntax, such as mpg < 5 ~ "gas guzzlers" |
.colname |
the name of the new group |
a new dataframe containing the overlapping groups which may create duplicates of individual rows.
library(tidyverse)
iris %>% dplyr::group_by(Species) %>% intersecting_group_by(
Sepal.Length > mean(Sepal.Length) ~ "Long",
Sepal.Width > mean(Sepal.Width) ~ "Wide"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.