R: Change value of an argument in ellipsis and pass ellipsis to the other function without using list() and eval()

荒凉一梦 提交于 2019-12-03 03:16:53

You do have to unpack ... to manipulate its contents. The ugly bit here, really, is your last line, which can be simplified to do.call(identical, a):

test <- function(...) {
  a <- list(...)
  a[['y']] <- 2
  do.call(identical, a)
}

test(x=1,y=1)
# [1] FALSE
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!