I am pretty sure my language is imprecise, but I don't know the correct terms yet. This is what I wanted to achieve:
I have a function abc2
. I want to obtain the arguments to them (without evaluating or changing the argument) provided by the user, to use in another function. E.g.
abc2 <- function(...) {
# what do I have to do here?
}
adf = data.frame(a = 1:3, b = 1:3)
bdf = data.frame(a = 11:13, b = 11:33)
such that calling abc2(a)
is the same as calling
dplyr::select(adf, a)
dplyr::select(bdf, a)
and that calling abc2("a")
is the same as calling
dplyr::select(adf, "a")
dplyr::select(bdf, "a")
Basically, I want to transplant the ...
from abc2 and apply them without any change from how the user has input it and apply elsewhere.
Base R and tidyeval explanation welcome! I am trying to read up on quo
and enquo
but I can't seem to get my head around it.