Description Usage Arguments Value Note Author(s) See Also
These are useful for writing functions that accept any number of
arguments but some may be missing. For example, arrays in R can
have any number of dimensions, indexed by the [
function, where a missing argument means to take all indexes on
that dimension. However there is not a good way to replicate
[
's behavior in base R; using list(...)
to
collect all positional arguments will throw errors on missing
arguments. Instead, use x <- list_missing(...)
and
is.missing(x) to detect missing arguments.
For ...
objects as made by dots
, performs
this check without forcing evaluation.
1 2 3 4 5 |
... |
for |
x |
If given a list, compares each
element with the missing value. Given a |
For dots_missing
, a logical vector.
For list_missing
, a named list of all evaluated
arguments, where any missing arguments are set to
missing_value()
.
For is.missing
, a vector of boolean values.
A frequently seen strategy is to use
match.call(expand.dots=TRUE)
and
eval(..., parent.frame())
to
screen for missing arguments while evaluating non-missing
arguments. This is not recommended because match.call does
not capture the environments of the arguments, leading to hygeine
violations.
Peter Meilstrup
missing_value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.