within
methods for R environments
# S3 method for environment
within(data, expr, ..., quote = substitute(expr))
# S3 method for character
within(
data,
expr,
...,
pos = 2L,
warn.conflicts = TRUE,
mask.ok = NULL,
quote = substitute(expr)
)
An R environment, or the name of a (potentially new) attached environment.
The bare R expression to evaluate. Automatically quoted.
Ignored. Added for compatibility with the S3 generic. Throws an
error if any arguments are passed to ...
.
An R language object. This is an escape hatch from the automatic
quoting of expr
.
The position where to attach the environment, if creating a new
one. If an environment of name
already exists, pos
is ignored.
logical. If TRUE (the default), print warnings about objects in the attached environment that that are masking or masked by other objects of the same name.
character vector of names of objects that can mask objects on
the search path without signaling a warning if warn.conflicts
is TRUE
.
The R environment, invisibly.
The only difference between attach_eval
and within.character
is
the order of the arguments and the return value; the first
returns the result of evaluating the expression, the latter the
environment.
See the note in attach_source
about a potential pitfall of evaluating
code directly in an attached environment.