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(names)

REQUIRED ARGUMENTS:

name
Name of one of the arguments to the function in which the call to hasArg occurs.

VALUE:

a logical value. If x is a standard argument, hasArg(x) returns TRUE if missing(x) is FALSE. Otherwise, hasArg(x) returns TRUE if ... is an argument and the actual call has a named argument of the form "x=".

SEE ALSO:

, , , , .

EXAMPLES:

setMethod("xyCall", signature("track", "missing"),
     function(x, y, f, ..., xexpr, yexpr) {
     if(missing(xexpr)) f(x@x, x@y, ...)
     else {
          xexpr <- deparseText(xexpr)
          dots <- list(...)
          if(hasArg(xlab)) xlab <- dots$xlab
          else xlab <- paste(xexpr, "(Positions)")
          if(hasArg(ylab)) ylab <- dots$ylab
          else ylab <- paste(xexpr, "(Measurements)")
          f(x@x, x@y, xlab = xlab, ylab = ylab, ...)
          }
     })