[R] Dynamic Dictionary Data Type?

Thomas Lumley tlumley at u.washington.edu
Thu Jun 2 17:53:11 CEST 2005


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




More information about the R-help mailing list