inside {admisc} | R Documentation |
Evaluate an Expression in a Data Environment
Description
Evaluate an R expression in an environment constructed from data.
Usage
inside(data, expr, ...)
## S3 method for class 'list'
inside(data, expr, keepAttrs = TRUE, ...)
Arguments
data |
Data to use for constructing an environment a |
expr |
Expression to evaluate, often a “compound” expression, i.e., of the form { a <- somefun() b <- otherfun() ..... rm(unused1, temp) } |
keepAttrs |
For the |
... |
Arguments to be passed to (future) methods. |
Details
This is a modified version of the base R function within))
, with exactly
the same arguments and functionality but only one fundamental difference:
instead of returning a modified copy of the input data, this function alters the
data directly.
Author(s)
Adrian Dusa
Examples
mt <- mtcars
inside(mt, hwratio <- hp/wt)
dim(mtcars)
dim(mt)