Learn R Programming

assertive (version 0.2-6)

has_arg: Does the current call have an argument?

Description

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

Usage

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

Arguments

x
Argument to check.
fn
Function to find the argument in.

Value

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

See Also

hasArg.

Examples

Run this code
has_arg(x, mean.default)
has_arg(y, mean.default)
f <- function(...) has_arg(z)
f(z = 123)
f(123)

Run the code above in your browser using DataLab