This help topic is for R version 0.90. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/zAlias.html
.Alias {base}R Documentation

Create “Alias” (Pointer) to R Object

Description

.Alias creates an alias to another (part of) an R object which is more (memory-) efficient than usual assignment.

Usage

new <- .Alias(expr)

Arguments

expr

an R expression; typically a name.

new

new name by which expr can be accessed.

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!

See Also

<- for usual assignments.

Examples

mop <- options()
mop $ browser <- "a browser"   # not set on all platforms
Op <- .Alias(mop)
## A change to mop is reflected in Op and vice versa
## -- ONLY if no new slots are created ...
mop $ digits <- "Wow!"
Op  $ browser <- "another one"
mop $ browser; Op $ digits
all(names(mop) == names(Op) &
    sapply(seq(mop), function(i) all(Op[[i]] == mop[[i]])))
##> TRUE -- Op and mop  *ARE* the same thing !

mop $ newslot <- pi #--->> 'newslot' ==> (shallow) COPY of 'mop'
 Op $ newslot# R (>= 0.63): still the old one, i.e. NULL
all(names(mop) == names(Op))# no longer TRUE [R >= 0.63]

[Package base version 0.90 ]