I have two functions
fn1 <- function(...) {
fn2(...)
}
I have a second function
fn2 <- function(...) {
match.call(expand.dots = FALSE)$...
}
Calling the first function with a symbol does not return the expected value
fn1(test)
# [[1]]
# ..1
I would expect test
to be returned (a symbol
).
We can use substitute
fn2 <- function(...) {
eval(substitute(alist(...) ))
}
fn2(test)
#[[1]]
#test
fn1(test)
#[[1]]
#test
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.