Description Usage Arguments Details Value See Also Examples
Evaluate an expression in the context of a data environment.
1 2 3 | scope(x, expr, envir = NULL)
scopeQuoted(x, expr, envir = NULL)
|
x |
a list or data object. |
expr |
an object to be evaluated. |
envir |
an enclosing environment, or |
The scopeQuoted evaluates its expr argument in a context that by
default looks for names first in x and then in envir. If the
expression contains a call to I() then the argument of that call gets
evaluatedc in the environment envir, not in x.
The scope function quotes its expr argument and then calls
scopeQuoted.
The scope evaluation mechanism gets used in all functions in the
‘frame’ package that require non-standard evaluation. It is
similar to the evaluation mechanism used by the model.frame
function, but is otherwise not used in base R.
The result of the evaluated expression expr.
1 2 3 4 5 6 7 8 9 10 11 12 | x <- list(a = 1:10, b = 10 * (1:10))
a <- 100000000
c <- 1000
# look up first in 'x', then in the calling environment
scope(x, a * b + c)
# look up 'a' in the calling environment, not in 'x'
scope(x, I(a) * b + c)
# evaluate a quoted expression
scopeQuoted(x, quote(a + c)) # equivalent to scope(x, a + c)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.