Re: [R] Dynamic Dictionary Data Type?

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Fri 03 Jun 2005 - 01:53:11 EST

On Thu, 2 Jun 2005, hadley wickham wrote:

>> An environment is a hash table, and copying occurs only on modification,
>> when any language would have to copy in this context.
>
> Yes, I'm aware that copying only occurs on modification. However, it
> was my understanding that
>
> a <- list(a =1)
> a$b <- 4
>
> would create a new copy of a, whereas in Java say
>

It depends, but I was talking about *environments*, not lists, and

a<-new.env()
assign("b",4,a)
assign("c", 42, a)
etc

wouldn't copy anything. Bill Venables had an article about environments for caching previously computed results in an early issue of R News.

         -thomas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 03 01:58:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:21 EST