dots: Dots objects: lists of quotations.

Description Usage Arguments Details Value Note Examples

Description

d <- dots(a = one, b = two) captures each of its arguments, unevaluated, in a dots object (a named list of quotations).

exprs(d) extracts a list of expressions from a dots object.

The mutator exprs(d) <- value returns a new dots object with the new expressions.

envs(d) extracts a list of environments from a dots object.

envs(d) <- value replaces the environments with the new value and returns an updated dots object.

as.data.frame.dots transforms the contents of a dots object into a data frame with one row per quotation, with columns:

forced_dots_(values) create from dots object from any data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
dots(...)

dots_(exprs, envs)

exprs(d)

## S3 method for class 'dots'
exprs(d)

exprs(d) <- value

## S3 replacement method for class 'dots'
exprs(d) <- value

envs(d)

## S3 method for class 'dots'
envs(d)

envs(d) <- value

## S3 replacement method for class 'dots'
envs(d) <- value

## S3 method for class 'dots'
x[..., drop = FALSE]

## S3 replacement method for class 'dots'
x[...] <- value

## S3 method for class 'dots'
c(...)

## S3 method for class 'quotation'
c(...)

## S3 method for class 'dots'
as.data.frame(x, row.names = NULL, ...)

forced_dots_(values)

Arguments

...

Any number of arguments.

exprs

An expression or list of expressions.

envs

An environment or list of environments.

d

A dots object.

value

A replacement value.

x

A dots object.

drop

See Extract.

row.names

If not given, uses make.unique(x$name)

values

A list; each element will be used as data.

Details

Objects of class "dots" mirror R's special variable .... Unlike ..., a dots is:

d <- dots(...) can be used to capture the contents of ... without triggering evaluation. This improves on substitute(...()) by capturing the environment of each component along with the expressions.

Value

A list with class 'dots', each element of which is a quotation.

dots_(exprs, envs) directly constructs a dots object given lists of expresions and environments.

exprs returns a named list of expressions.

envs(d) returns a named list of environments.

as.data.frame.dots returns a data frame.

Note

The columns have a class "oneline" for better printing.

Examples

1
2
3
4
5
6
7
named.list <- function(...) {
 # Collect only named arguments, ignoring unnamed arguments.
 d <- dots(...)
 do(list, d[names(d) != ""])
}

named.list(a=1, b=2*2, stop("this is not evaluated"))

crowding/nse documentation built on May 16, 2019, 7:44 a.m.