Skip to content

Deleting column used in grouping should remove grouped_df attribute #2031

@puzzledvacuum

Description

@puzzledvacuum

If the user has a grouped_df and sets one of the coulumns used in the grouping to NULL this should remove the grouped_df attribute and make it a regular tbl.

Currently, if the user sets a column used as a grouping to NULL, and then tries to rename a different column, this causes the R session to abort.

Example:

df = data_frame(a = c(1,2,3), b = c(2,3,4), d = c(4,5,6))  
df = df %>% group_by(a,b)  
df$a = NULL  
class(df)
## [1] "grouped_df" "tbl_df"     "tbl"        "data.frame"
df = df %>% rename(a = d)

At this point the R session will crash.

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions