| dots | R Documentation |
d <- dots(a = one, b = two) captures each of its arguments,
unevaluated, in a dots object (a named list of quotations).
as.data.frame.dots transforms the contents of a dots object
into a data frame with one row per quotation, with columns:
name: a character,
expr: an expression,
env: an environment object or NULL if forced,
value: NULL or a value if forced.
forced_dots(...) forces its arguments and constructs a dots object with
forced quotations.
forced_dots_(values) creates a dots object from a list of values
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 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(...)
forced_dots_(values)
... |
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 or list of values. |
x |
A |
drop |
See Extract. |
row.names |
If not given, uses |
values |
A list; each element will be used as data. |
Objects of class "dots" mirror R's special variable ....
Unlike ..., a dots is:
immutable (evaluating does not change it),
first-class (you can give it any name, not just ...),
data (The R interpreter treates it as literal data rather than triggering argument splicing).
d <- dots(...) is used to capture the contents of ... without
triggering evaluation. This improves on
as.list(substitute(...())) by capturing the environment of each
argument along with their expressions. (You can also use
get_dots().)
dots(...) constructs a list with class 'dots', each
element of which is a quotation.
dots_(exprs, envs) constructs a dots object given lists
of expressions and environments. (To construct a dots object from
quotation objects, use c().)
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) returns a named list of environments.
envs(d) <- value returns an updated dots object with the
environments replaced with the new value(s).
as.data.frame.dots returns a data frame.
The columns have a class "oneline" for better printing.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.