Displaying 2 results from an estimated 2 matches for "dots4".
Did you mean:
dots
2018 Aug 13
1
substitute() on arguments in ellipsis ("dot dot dot")?
Since you're already using bang-bang ;)
library(rlang)
dots1 <- function(...) as.list(substitute(list(...)))[-1L]
dots2 <- function(...) as.list(substitute(...()))
dots3 <- function(...) match.call(expand.dots = FALSE)[["..."]]
dots4 <- function(...) exprs(...)
bench::mark(
dots1(1+2, "a", rnorm(3), stop("bang!")),
dots2(1+2, "a", rnorm(3), stop("bang!")),
dots3(1+2, "a", rnorm(3), stop("bang!")),
dots4(1+2, "a", rnorm(3), stop("bang!"))...
2018 Aug 13
2
substitute() on arguments in ellipsis ("dot dot dot")?
Interestingly,
as.list(substitute(...()))
also works.
On Sun, Aug 12, 2018 at 1:16 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 12/08/2018 4:00 PM, Henrik Bengtsson wrote:
>>
>> Hi. For any number of *known* arguments, we can do:
>>
>> one <- function(a) list(a = substitute(a))
>> two <- function(a, b) list(a = substitute(a), b =