Aliases: check_exclusive
Keywords:
### ** Examples f <- function(x, y) { switch( check_exclusive(x, y), x = message("`x` was supplied."), y = message("`y` was supplied.") ) } # Supplying zero or multiple arguments is forbidden try(f())
Error in f() : One of `x` or `y` must be supplied.
try(f(NULL, NULL))
Error in f(NULL, NULL) : Exactly one of `x` or `y` must be supplied.
# The user must supply one of the mutually exclusive arguments f(NULL)
f(y = NULL)
# With `.require` you can allow zero arguments f <- function(x, y) { switch( check_exclusive(x, y, .require = FALSE), x = message("`x` was supplied."), y = message("`y` was supplied."), message("No arguments were supplied") ) } f()