If I want to see what expression is passed to the function, I can get it with substitute.
f <- function(x)
{
substitute(x)
}
f(sin(pi))
( freturns an object of the class call. substituteUsually combined with deparseto turn it into a character vector, but I'm not interested here.)
I want to repeat this with arguments in .... This attempt returns only the first argument:
g <- function(...)
{
substitute(...)
}
g(sin(pi), cos(pi / 2))
This attempt causes an error:
h <- function(...)
{
lapply(..., subsitute)
}
h(sin(pi), cos(pi / 2))
This attempt causes another error:
i <- function(...)
{
lapply(list(...), substitute)
}
i(sin(pi), cos(pi / 2))
How to get the expressions that I passed in ...?
source
share