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

Duncan Murdoch murdoch at stats.uwo.ca
Mon Dec 22 20:09:13 CET 2008


On 12/22/2008 1:55 PM, murdoch at stats.uwo.ca wrote:
> 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!

The fix looks easy:  The problem is that the NAMED status of the 
component being extracted was miscalculated when using a vector index. 
I'll commit a change after testing...

Duncan Murdoch

> 
> Duncan Murdoch
> 
>  > sessionInfo()
> R version 2.8.1 (2008-12-22)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
> States.1252;LC_MONETARY=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
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list