wrap {refset} | R Documentation |
Refsets (and other active bindings) cannot be passed as function
arguments, since doing so makes a copy. wrap
allows you to pass
arbitrary expressions between functions and records where they are
ultimately evaluated.
wrap(expr, env = parent.frame())
expr |
an R expression |
env |
environment in which |
An object of class 'parcel', with components expr
and env
.
Other wrapping functions: contents
,
is.parcel
, unwrap_as
,
wrapset
dfr <- data.frame(a=1:4, b=1:4)
rs %r% dfr[1:2,]
parcel <- wrap(rs)
f <- function (parcel) contents(parcel) <- contents(parcel)*2
f(parcel)
contents(parcel)
dfr
parcel <- wrap(x^2) # non-refset use
x <- 3
f <- function(parcel) {x <- 10; contents(parcel)}
f(parcel)