Bugzilla – Bug 15374
[[<- with non-scalar index on lists introduces reference semantics
Last modified: 2013-07-03 17:19:04 UTC
l = list(list(1))
l1 = l[]
l[[c(1, 1)]] = 2
we would not expect l1 to be modified, but it is
> stopifnot(l1 == 1)
Error: l1 == 1 is not TRUE
[[<- only duplicates the top-level object, and only when NAMED is 2. It instead needs to duplicate recursively, where the NAMED for a child is considered as max(NAMED(parent), NAMED(child)).
 "R Under development (unstable) (2013-07-01 r63132)"
Thanks for the report. Fixed for the trunk in r63166; in r63167 for R-3-0-patched.
This is fixed by having vectorIndex take an additional dup argument, FALSE when called from [[ and TRUE for [[<- calls. When TRUE substructure is duplicated as it is traversed if NAMED > 1.