Learn R Programming

vadr (version 0.01)

dots: Capture a list of ... arguments as an object.

Description

dots and methods of class ... provide a more convenient interface to capturing lists of unevaluated arguments and applying them to functions.

Usage

dots(...)

Arguments

...
Any number of arguments.

Value

A dots object. This is currently just the raw DOTSXP with the object bit set and the class set to "..." so that method dispatch works.

See Also

%<

Examples

Run this code
reverse.list <- function(...) {
 d <- dots(...)
 list %()% rev(d)
}
reverse.list("a", b="bee", c="see")

named.list <- function(...) {
 d <- dots(...)
 list %()% d[names(d) != ""]
 }
named.list(a=1, b=2*2, stop("this is not evaluated"))

Run the code above in your browser using DataLab