set_
is a normally-evaluating version of <-
.
set_enclos_
is a normally evaluating version of
<<-
.
Usage
set_(dest, val)
set_enclos_(dest, val)
Arguments
- dest
A quotation specifying the destination environment
and name. This can also be an indexing, expression, and set_
will
perform subassignment.
- val
The value to assign.
Value
set_
returns val
, invisibly.
Details
set_
differs from [assign]
in that set_
will process
subassignments.
These helpers are here because it is tricky to use do_
with
<-
(see Note under do_).
Examples
set_(quo(x), 12) #equivalent to `x <- 12`
set_(quo(x[3]), 12) #equivalent to `x[3] <- 12`
e <- new.env()
set_(quo(x[3], e), 12) #assigns in environment `e`
set_enclos_(quo(x[3], e), 12) #assigns in a parent of environment `e`