within.environment: 'within' methods for R environments

View source: R/within.R

within.environmentR Documentation

within methods for R environments

Description

within methods for R environments

Usage

## 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 June 22, 2024, 11:04 a.m.