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

Add [ method for grouped_df #4708

Closed
hadley opened this issue Jan 7, 2020 · 0 comments
Closed

Add [ method for grouped_df #4708

hadley opened this issue Jan 7, 2020 · 0 comments
Labels
feature grouping 👨‍👩‍👧‍👦

Comments

@hadley
Copy link
Member

hadley commented Jan 7, 2020

`[.grouped_df` <- function(x, i, j, drop = FALSE) {
   out <- NextMethod()
   groups <- intersect(names(out), dplyr::group_vars(x))

   if (length(groups)) {
     dplyr::grouped_df(out, groups)
   } else {
     dplyr::tbl_df(out)
   }
 }

Related to #4004

@hadley hadley added feature grouping 👨‍👩‍👧‍👦 labels Jan 7, 2020
hadley added a commit that referenced this issue Jan 7, 2020
@hadley hadley closed this as completed in 1599df5 Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature grouping 👨‍👩‍👧‍👦
Projects
None yet
Development

No branches or pull requests

1 participant