Learn R Programming

twidlr (version 0.0.0.9000)

check_alt_args: Check if argument(s) are given as alternatives to another

Description

Check for certain arguments that, if present, will result in function producing an error and stopping the function if desired.

Usage

check_alt_args(..., target, alts, stop = TRUE)

Arguments

...
Named arguments. Typically passed from another function.
target
String of variable for which alternatives may be present.
alts
Character vector of arguments that may act as alternatives to the target
stop
Boolean. If True, stop() is called with an error message. If False, warning() is called with an error message.

Examples

Run this code
## Not run: ------------------------------------
# check_alt_args(a = 10, target = "a", alts = c("b"))
# check_alt_args(b = 10, target = "a", alts = c("b"))
# check_alt_args(b = 10, target = "a", alts = c("b"), stop = FALSE)
## ---------------------------------------------

Run the code above in your browser using DataLab