View source: R/arg_dots_supplied.R
| arg_dots_supplied | R Documentation |
Checks whether an argument was supplied to ....
arg_dots_supplied(..., .msg = NULL, .call)
arg_dots_not_supplied(..., .msg = NULL, .call)
... |
the |
.msg |
an optional alternative message to display if an error is thrown instead of the default message. |
.call |
the execution environment of a currently running function, e.g. |
arg_dots_supplied() checks whether arguments were passed to the ... (i.e., "dots") argument of a function. These arguments are not evaluated. arg_dots_supplied() throws an error if ...length() is 0. It can be useful for when a function must have additional arguments. For example, arg_or() and when_supplied() use arg_dots_supplied().
arg_dots_not_supplied() checks whether no arguments were passed to ..., again without evaluating the arguments and using ...length(). It can be useful when a function appears to allow further arguments (e.g., because it is a method of a generic), but when the author does not want the user to supply them.
Returns NULL invisibly if an error is not thrown.
arg_supplied()
f <- function(...) {
arg_dots_supplied(...)
}
try(f(1)) # No error: argument supplied
try(f()) # Error!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.