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

Give advice on reusable selection helpers #290

Merged
merged 1 commit into from Aug 16, 2022
Merged

Give advice on reusable selection helpers #290

merged 1 commit into from Aug 16, 2022

Conversation

hadley
Copy link
Member

@hadley hadley commented Aug 12, 2022

Fixes #270

After writing this, I'm not sure this is quite the right place, but we definitely need this advice somewhere.

@hadley hadley requested a review from lionel- August 12, 2022 13:13
To make this work you'll need to do two things:

* Wrap the whole thing in a function
* Use `any_of()` or `all_of()` instead of bare variable names
Copy link
Member

Choose a reason for hiding this comment

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

Does all_of() now return a vector of positions after the recent changes? If yes, do we have a unit test for the combination of all_of() and helpers like starts_with()? If not, we should keep #270 around, or open a new issue.

Copy link
Member

Choose a reason for hiding this comment

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

Should we add an info bullet pointing to this page in the out-of-context error?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think nothing has changed with all_of(), except that (e.g) all_of(1) is now coerced to an integer vector.

And this is the Rd topic that peek_vars() points to 😄

@hadley hadley merged commit 135caf9 into main Aug 16, 2022
@hadley hadley deleted the reuse-advice branch August 16, 2022 13:39
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.

read_csv(col_select = dplyr::select() variable) fails at variable declaration time
2 participants