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

Use $pick() when across(.fns = NULL) is specified #6393

Merged
merged 3 commits into from
Aug 9, 2022

Conversation

DavisVaughan
Copy link
Member

Closes #6380 (alternative)
Closes #6264

@hadley I think I like this approach more?

  • It seems a lot simpler to me
  • It avoids a new argument to current_cols() (which I think shouldn't ever alter the cols if possible)
  • It matches the spirit of what an official pick() function would do. It would be semantically the same as across(.fns = NULL), so it is nice to see that we internally use $pick() for the across(.fns = NULL) code path.

I think this further supports the need for pick(). It would allow us to "purify" across() a bit more with rowwise data frames. Once we deprecate .fns = NULL, across() would always work directly on list column elements VS pick() which would always preserve the full list-column as-is

`.fns = NULL` will eventually be deprecated in favor of an official way to select columns, but the new way will have the same semantics of preserving list-columns as-is
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks a lot cleaner to me.

You might also want to remove the same old test that I did at https://github.com/tidyverse/dplyr/pull/6380/files#diff-45e563b486cc3a0bec1b439f59112c55a9ef8688d3ae465ce8fda8ac2c7c576fL514

@DavisVaughan DavisVaughan merged commit db4010f into tidyverse:main Aug 9, 2022
@DavisVaughan DavisVaughan deleted the fix/empty-across-rowwise branch August 9, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Printing error involving group_nest, rowwise , and across
2 participants