Closed marinsokol5 closed 5 years ago
I just can't seem to get something to work and although I do know that this is not the right place for posting this, it is the easiest way to get response from you, rlang developers.
I recommend posting questions on Stackoverflow or community.rstudio.com.
You're right that capturing inputs and looking for c()
is not the right way. I think you're looking for external quoting. You can require your users to pass variables with dplyr::vars()
. It is a simple alias to quos()
with a friendlier name.
f <- function(df, group1) {
stopifnot(is_list(group1))
dplyr::group_by(df, !!!group1)
}
f(mtcars, vars(cyl, am))
See https://tidyeval.tidyverse.org/dplyr.html#vars---quote-multiple-arguments-externally
I recommend posting questions on Stackoverflow or community.rstudio.com.
This way the answer benefits to other users.
Hi I just can't seem to get something to work and although I do know that this is not the right place for posting this, it is the easiest way to get response from you, rlang developers.
It is an really easy example.
Is there any way of doing this without some hacking. By hacking I mean, turning c(a,b) to a string and then removing "c(" and ")" and splitting by "," and then turning all of that to quosure vector by
quos(!!! syms(group))
Thanks in advance.
All the best.