Closed vnijs closed 5 years ago
If you're pulling out a single variable, I think it's better to be explicit about what it is so that you get a clear error message if the data changes for some reason.
@Hadley Does that apply to the question about pull_at
as well?
## but if gear is also a variable in the data we may not get the expected result
gear <- "vs"
pull(mtcars, gear)
#> [1] 4 4 4 3 3 3 3 4 4 4 4 3 3 3 3 3 3 4 4 4 3 3 3 3 3 4 5 5 5 5 5 4
Just use unquoting: pull(mtcars, !!gear)
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
pull
is a very nice complement toselect
. I wonder if it might be useful to add apull_at
type function to dplyr and make some of the special functions you can use inselect
(e.g., "starts_with") available inpull
as well. Some relevant examples in a regex belowCreated on 2018-12-30 by the reprex package (v0.2.1)