[R] Is there a test for .Alias?

Henrik Bengtsson hb at maths.lth.se
Thu Aug 2 05:03:43 CEST 2001


Is there a way to check if a variable is aliases to another? Example:

  x <- list(a=1, b=2, c=3)
  y <- .Alias(x)

Can one tell that 'y' is an alias to another object? By the way, is it a
correct statement to say that 'y' is aliased TO 'x', or is both 'x' and 'y'
said to be aliased to an internal object?

Example continued:

  y$a <- NULL  # Here 'y' becomes a shallow copy since the slot 'a' is
removed.
  y$a <- 1

Is there an is.Alias(y)? I could see how to do a is.AliasedTo(y, x) by
testing if a modification in 'y' is reflected in 'x'. The reason for using
.Alias is that I would like to use it because of memory and speed issues in
function calls etc.


Thanks to everyone

Henrik Bengtsson
Statistics Department
Lund University

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list