Skip to content

Add [ method for grouped_df #4708

Closed
Closed
@hadley

Description

@hadley
Member
`[.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

Activity

added a commit that references this issue on Jan 7, 2020
713c61e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @hadley

        Issue actions

          Add [ method for grouped_df · Issue #4708 · tidyverse/dplyr