繁体   English   中英

match.call() 在子 function 中评估时返回..1

[英]match.call() returns ..1 when evaluated in a sub function

我有两个功能

fn1 <- function(...) {
  fn2(...)
}

我有第二个 function

fn2 <- function(...) {
  match.call(expand.dots = FALSE)$...
}

用符号调用第一个 function 不会返回预期值

fn1(test)
# [[1]]
# ..1

我希望test返回(一个symbol )。

我们可以使用substitute

fn2 <- function(...) {
     eval(substitute(alist(...) ))

   }
fn2(test)
#[[1]]
#test
fn1(test)
#[[1]]
#test

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM