missing
Check for Missing Arguments
Description
Return a logical value indicating whether x was supplied
as an argument to the function in which missing is placed.
Usage
missing(x)
Arguments
x |
the name of an argument to the function in which the call
to missing occurs.
This can also be ... to check if all of the ...
arguments are missing, or ..1, ..2, etc.
to check if the 1st, 2nd, etc. ... argument is missing.
This can also be a string constant containing a variable name
or "..." or "..1", etc.
|
Details
Used internally within a function as a conditional. Checks to see
if the argument specified by name is supplied to the function.
Value
returns a logical value.
If TRUE, the current call does not supply the argument named;
otherwise, FALSE.
Also returns
TRUE if the current call provides
an argument but the argument is a variable that is missing in the calling function.
Returns an error if:
- The argument to missing is not the name of an argument.
- The argument to missing is ... or ..n, but
... is not an argument to the function.
Note
missing considers arguments to be omitted even when a default
value is defined.
See Also
Examples
function(y, weight)
{
if(!missing(weight))y <- y * sqrt(weight)
...
}