Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

check_dots_used

Check that all dots have been used


Description

Automatically sets exit handler to run when function terminates, checking that all elements of ... have been evaluated. If you use on.exit() elsewhere in your function, make sure to use add = TRUE so that you don't override the handler set up by check_dots_used().

Arguments

env

Environment in which to look for ... and to set up handler.

action

The action to take when the dots have not been used. One of rlang::abort(), rlang::warn(), rlang::inform() or rlang::signal().

Examples

f <- function(...) {
  check_dots_used()
  g(...)
}

g <- function(x, y, ...) {
  x + y
}
f(x = 1, y = 2)

try(f(x = 1, y = 2, z = 3))
try(f(x = 1, y = 2, 3, 4, 5))

ellipsis

Tools for Working with ...

v0.3.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.