...elt
Manipulate Ellipsis Arguments

### Description

Counts the number of arguments in ... or evaluates one of the arguments without unecessarily evaluating any of them.

### Usage

    ...elt(n)
    ...length()
    ...names()
    chkDots(..., which.call = -1, allowed = character(0))

### Arguments

n | an integer specifying which ... argument to evaluate.
... | typically ... from this function's caller. If this argument is not empty, a warning is given indicating that these arguments are not used in this function.
which.call | a negative integer indicating how far down the call stack the possible warning message appears to come from.
allowed | a character vector specifying the names of arguments in ... that should not cause a warning.

### Details

In many cases, you want to evaluate all of the ... arguments. list(...) is the usual way to do this.
Methods of generic functions can call chkDots(...) to warn users that this method is ignoring the extra arguments.
Value

- ...length() returns the number of ... arguments given to a function.
- ...elt{n} returns the evaluated n'th of the ... arguments.
- ...names{} returns the names attached to the ... arguments, with NA for the untagged arguments.
- chkDots(...) returns NULL, invisibly.

...elt, ...names, and ...length give an error if there are no ... arguments in scope.
See Also
substitute
Examples

    f1 <- function(n, ...) ...length()
    f1(stop(10), stop(20), stop(30))
    f2 <- function(n, ...) ...elt(n)
    f2(2, stop(20), 1+2+3)
    # find the tags of the ... arguments without evaluating them
    f3 <- function(n, ...) {
        dots <- substitute(...())
        names(dots)
    }
    f3(n=2, X=stop(X), stop(Y), Z=stop(Z))
    f4 <- function(n, ...) {
        ...names()
    }
    f4(n=2, X=stop(X), stop(Y), Z=stop(Z))

Package base version 6.1.5-18
Package Index