Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax for temporary grouping #4711

Closed
hadley opened this issue Jan 7, 2020 · 2 comments · Fixed by #4751
Closed

Syntax for temporary grouping #4711

hadley opened this issue Jan 7, 2020 · 2 comments · Fixed by #4751
Labels
feature grouping 👨‍👩‍👧‍👦 wip

Comments

@hadley
Copy link
Member

hadley commented Jan 7, 2020

Syntax ideas:

df %>% with_groups(mutate, this, that)(foo = 1)

df %>% with_groups(c(this, that), mutate, foo = 1)
@romainfrancois
Copy link
Member

romainfrancois commented Jan 8, 2020

I think I prefer the second one. I suppose we could make it compatible to this as well:

df %>% with_groups(c(this, that), ~ mutate(., foo = 1))

@hadley
Copy link
Member Author

hadley commented Jan 8, 2020

Ah yes, nice! And that actual solves a tidy-eval challenge I was having

@hadley hadley added the wip label Jan 8, 2020
hadley added a commit that referenced this issue Jan 14, 2020
hadley added a commit that referenced this issue Jan 15, 2020
This PR starts to develop the dplyr "interface", i.e. the set of generics that you need to provide methods for if you want to extend dplyr to work with new data frame subclasses. It also uses those methods (along with a count_regroups()) to ensure that the existing grouped_df implementations are not needlessly regrouping data.

Fixes #4086 because count() can now use dplyr_reconstruct() to restore the original class
Fixes #4051 because I've carefully documented the return value of the major verbs
Fixes #4711 since implementing with_groups() is now easy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature grouping 👨‍👩‍👧‍👦 wip
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants