Create ``Alias'' (Pointer) to \R Object
Usage
new <- .Alias(expr)
Arguments
expr
|
an R expression; typically a name.
|
new
|
new name by which expr can be accessed.
|
Description
.Alias
creates an alias to another (part of) an R
object which is more (memory-) efficient than usual assignment.Value
an identical copy of expr
.WARNING
This has a dangerous semantic, and consequences can be
unexpected (it can be used to defeat the call-by-value illusion).
Know what you are doing before using .Alias
!References
~put references to the literature/web site here ~See Also
<-
for usual assignments.Examples
mop <- options()
Op <- .Alias(mop)
## Any change to mop is reflected in Op and vice versa!
mop $ newslot <- pi
Op $ newslot # 3.1415..
mop $ digits <- "Wow!"
Op $ another <- 2
mop $ another; Op $ digits
all(names(mop) == names(Op))# TRUE -- Op and mop *ARE* the same thing