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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 1 Aug 2001, Henrik Bengtsson wrote:> 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?The correct statement is that, since .Alias shouldn't be used, 'y' is not aliased to 'x'. You can't tell except in internal C code by checking that the objects are pointers to the same place. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._