Lets say I have the functions foo and bar as follows
bar <- function(a, b) {
# Some operations with a and b ...
}
foo <- function(...) {
test <- baz(bar(...))
return (test)
}
Is there a function baz that returns the bar-call as a string with the arguments specified in ... expanded? So, when i do
> foo(a = 1, b = 2)
i expect to get something like
[1] "bar(a = 1, b = 2)"This can be done by pasting the arguments in ..., but i would prefer some built-in solution that is more clean and nice.
So, say instead that bar is some pre-built function, knitr::kable in my case. How would I get the same result for this? For this say that knitr::kable has the same inputs as bar, i.e. a and b. The function foo now looks like this
foo <- function(...) {
test <- baz(knitr::kable(...))
return (test)
}
So I want the call
> foo(a = 1, b = 2)
to return something like
[1] "kable(a = 1, b = 2)"