[Rd] Bug in list indexing (PR#13411)

murdoch at stats.uwo.ca murdoch at stats.uwo.ca
Mon Dec 22 19:55:11 CET 2008

I was wondering if copies were made when a component of a complex nested 
list structure was extracted but not modified.  I was happy that the 
answer was no, but was surprised that copies weren't made even if the 
extracted bit was modified:

 > x <- list(a=list(b=numeric(1000000)))
 > y <- x[[c(1,1)]]
 > y[1] <- 3.14159
 > x[[c(1,1)]][1]
[1] 3.14159

Unfortunately, this exists in today's release of 2.8.1.  I should have 
done this test last week!

Duncan Murdoch

 > sessionInfo()
R version 2.8.1 (2008-12-22)

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_2.8.1

More information about the R-devel mailing list