Code
list2(1, , 3)
Condition <rlang_error>
Error in `list2()`:
! Argument 2 can't be empty.
Code
dots_list(1, , 3)
Condition <rlang_error>
Error in `dots_list()`:
! Argument 2 can't be empty.
.homonyms
= 'error' fails with homonymsCode
(expect_error(list_error(1, a = 2, a = 3)))
Output
<error/rlang_error>
Error in `list_error()`:
! Arguments in `...` must have unique names.
x Multiple arguments named `a` at positions 2 and 3.
Code
(expect_error(list_error(1, a = 2, b = 3, 4, b = 5, b = 6, 7, a = 8)))
Output
<error/rlang_error>
Error in `list_error()`:
! Arguments in `...` must have unique names.
x Multiple arguments named `a` at positions 2 and 8.
x Multiple arguments named `b` at positions 3, 5, and 6.
Code
(expect_error(list_error(1, a = 2, b = 3, 4, b = 5, b = 6, 7, a = 8)))
Output
<error/rlang_error>
Error in `list_error()`:
! Arguments in `...` must have unique names.
x Multiple arguments named `a` at positions 2 and 8.
x Multiple arguments named `b` at positions 3, 5, and 6.
.ignore_empty
is matchedCode
(expect_error(dots_list(.ignore_empty = "t")))
Output
<error/rlang_error>
Error in `dots_list()`:
! `.ignore_empty` must be one of "trailing", "none", or "all", not "t".
i Did you mean "trailing"?
Code
foo <- (function() dots_list(.ignore_empty = "t"))
(expect_error(foo()))
Output
<error/rlang_error>
Error in `dots_list()`:
! `.ignore_empty` must be one of "trailing", "none", or "all", not "t".
i Did you mean "trailing"?
.homonyms
error is thrownCode
(expect_error(f()))
Output
<error/rlang_error>
Error in `f()`:
! Arguments in `...` must have unique names.
x Multiple arguments named `a` at positions 1 and 2.
list2(!!!x)
returns x
without duplicationCode
x <- as.list(1:100)
with_memory_prof(out <- list2(!!!x))
Output
[1] 0 B
Code
expect_equal(out, as.list(x))
x <- 1:100 + 0L
with_memory_prof(out <- list2(!!!x))
Output
[1] 848 B
Code
expect_equal(out, as.list(x))
Code
fn(x, x, x, x, x, x)
Output
[1] 0 B
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.