From murdoch at stats.uwo.ca  Mon Dec 22 20:09:13 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 22 Dec 2008 14:09:13 -0500
Subject: [Rd] Bug in list indexing (PR#13411)
In-Reply-To: <20081222185511.4E29C282EFF6@mail.pubhealth.ku.dk>
References: <20081222185511.4E29C282EFF6@mail.pubhealth.ku.dk>
Message-ID: <494FE5D9.6080703@stats.uwo.ca>

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



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