assert_has_arg

0th

Percentile

Does the current call have an argument?

Checks to see if the current call has an argument with the name given in the input.

Usage
assert_has_arg(x, fn = sys.function(sys.parent()),
  severity = getOption("assertive.severity", "stop"))

has_arg(x, fn = sys.function(sys.parent()))

has_arg_(x, fn = sys.function(sys.parent()))

Arguments
x

Argument to check.

fn

Function to find the argument in.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

Value

has_arg reimplements hasArg, letting you choose the function to search in, and providing more information on failure.

Note

has_arg is for interactive use and takes an unquoted argument name; has_arg_ is for programmatic use and takes a string naming a argument.

See Also

hasArg.

Aliases
  • assert_has_arg
  • has_arg
  • has_arg_
Examples
# NOT RUN {
has_arg(x, mean.default)
has_arg(y, mean.default)   
f <- function(...) has_arg(z)   
f(z = 123)
f(123)
# }
Documentation reproduced from package assertive.code, version 0.0-3, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.