If I want to know what is stored in the argument ...inside the R function, I can just convert it to a list, for example
foo <- function(...)
{
dots <- list(...)
print(dots)
}
foo(x = 1, 2, "three")
I can't figure out how to evaluate ...in the calling function. In the following example, I want the content to bazreturn an argument ...to bar.
bar <- function(...)
{
baz()
}
baz <- function()
{
print(dots)
}
bar(x = 1, 2, "three")
get("...", envir = parent.frame())returns <...>that looks promising, but I can't figure out how to extract anything useful from it.
eval(list(...), envir = parent.frame())throws an error, claiming that it is ...used incorrectly.
How to get ...out bar?
source
share