within.environment: 'within' methods for R environments

Description Usage Arguments Details Value Note See Also

View source: R/within.R

Description

within methods for R environments

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## S3 method for class 'environment'
within(data, expr, ..., quote = substitute(expr))

## S3 method for class 'character'
within(
  data,
  expr,
  ...,
  pos = 2L,
  warn.conflicts = TRUE,
  mask.ok = NULL,
  quote = substitute(expr)
)

Arguments

data

An R environment, or the name of a (potentially new) attached environment.

expr

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 ....

quote

An R language object. This is an escape hatch from the automatic quoting of expr.

pos

The position where to attach the environment, if creating a new one. If an environment of name already exists, pos is ignored.

warn.conflicts

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.

mask.ok

character vector of names of objects that can mask objects on the search path without signaling a warning if warn.conflicts is TRUE.

Details

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.

Value

The R environment, invisibly.

Note

See the note in attach_source about a potential pitfall of evaluating code directly in an attached environment.

See Also

attach_eval attach_source eval within


envir documentation built on Nov. 26, 2020, 9:06 a.m.