How to expand an ellipsis (…) argument without evaluating it in R

后端 未结 3 1817
别跟我提以往
别跟我提以往 2020-12-06 02:50

I need a function that accepts an arbitrary number of arguments and stores them in a variable as an expression without evaluating them. I managed to do it with match.c

3条回答
  •  孤街浪徒
    2020-12-06 03:13

    The most idiomatic way is:

    f <- function(x, y, ...) {
      match.call(expand.dots = FALSE)$`...`
    }
    

提交回复
热议问题