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

vars_pull() doesn't scope in helpers #161

Closed
hadley opened this issue Jan 14, 2020 · 3 comments
Closed

vars_pull() doesn't scope in helpers #161

hadley opened this issue Jan 14, 2020 · 3 comments

Comments

@hadley
Copy link
Member

hadley commented Jan 14, 2020

tidyselect::vars_pull(letters, any_of("x"))
#> Error in any_of("x"): could not find function "any_of"

Created on 2020-01-14 by the reprex package (v0.3.0)

@lionel-
Copy link
Member

lionel- commented May 8, 2020

Is it clear that we want to scope them in? I guess it can be useful interactively when the user knows a queries can only return one variable. I'm not sure any_of() makes sense in a pull context though, since it's mandatory to return one variable. I was thinking it could be helpful to have an any-of- or all-of-like helper for selecting exactly one variable.

@lionel- lionel- added the pull label May 8, 2020
@lionel-
Copy link
Member

lionel- commented May 8, 2020

Not sure this makes much sense but it works now:

dplyr::pull(mtcars, .data[["cyl"]])
#>  [1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4

@lionel- lionel- added the helpers label May 8, 2020
@hadley
Copy link
Member Author

hadley commented May 8, 2020

Yeah, I think pull is really yet another minor variation on tidyselect since it also uses negative values to index from the RHS.

@hadley hadley closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants