Skip to content

Should dplyr commands gobble empty last argument? #1039

@rpruim

Description

@rpruim

It would be nice to allow a trailing comma in commands like the example below. That would make it easier to rearrange the order or to comment out lines without needing to figure out whether the commas need adjusting.

diamonds %>%
  group_by(color, clarity) %>%
  summarise(
    depth = mean(depth),
    price = mean(price),
    carat = mean(carat),  #  <-- trailing comma here currently causes errors
  )

I'm imaging a function that could be called at the top of a function definition that would gobble this empty argument. Or perhaps a wrapper function a la Vectorize() that could be used to convert any function into a function with this behavior. Seems like this could be useful for many functions both within dplyr and elsewhere.

Metadata

Metadata

Assignees

Labels

featurea feature request or enhancement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions