View source: R/stop_if_dot_args.R
stop_if_dot_args | R Documentation |
Generate a stop with a good error message if the dots argument was a non-trivial list. Useful in writing functions that force named arguments.
stop_if_dot_args(dot_args, msg = "")
dot_args |
substitute(list(...)) from another function. |
msg |
character, optional message to prepend. |
NULL or stop()
f <- function(x, ..., inc = 1) {
stop_if_dot_args(substitute(list(...)), "f")
x + inc
}
f(7)
f(7, inc = 2)
tryCatch(
f(7, 2),
error = function(e) { print(e) }
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.