hasArg
Check for Argument Names

Description

Checks the current call for an argument corresponding to name. The name can be one of the formal arguments or a named component of .... The behavior on ... distinguishes this function from !missing(name).

Usage

hasArg(name)

Arguments

name an argument to the function in which the call to hasArg occurs. This can also be a string constant specifying an argument name.
Value
returns a logical value.
See Also
missing, names, match.call, args, match.arg.
Examples
ftest <- function(x1, ...) c(hasArg(x1), hasArg(y2))

ftest(1) ## [1] TRUE, FALSE ftest(1, 2) ## [1] TRUE, FALSE ftest(y2=2) ## [1] FALSE, TRUE ftest(y=2) ## [1] FALSE, FALSE (no partial matching on ... args)

ftest(y2=2, x=1) ## [1] TRUE, TRUE ## 'x' actual argument partial matches to x1 before hasArg is called

Package methods version 6.1.4-13
Package Index