From tlumley@u.washington.edu  Wed Apr 10 17:29:07 2002
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Wed, 10 Apr 2002 09:29:07 -0700 (PDT)
Subject: [Rd] Strange assignment bug (PR#1450)
In-Reply-To: <x28z7v7hor.fsf@blueberry.kubism.ku.dk>
Message-ID: <Pine.A41.4.44.0204100927040.103838-100000@homer25.u.washington.edu>

On 10 Apr 2002, Peter Dalgaard BSA wrote:

> G.Innocent@vet.gla.ac.uk writes:
>
> > 6) The above code appears to be the minimum of code required to reproduce
> > the results on my machine.
>
> You can do better than that:
>
> > f
> function(A) {
>   A$p[1] <- 2
>   E <- A$p
>   E[1:2] <- 0.1*A$p[2:3]
>   return(A)
> }
<snip>
> Notice that the last line changing E is effectively changing A$p, so
> something is up with our duplication-avoidance scheme. Luke?

and it matters that the assignment to E is coming from A$p. If it comes
from A$q or from some other vector then the bug doesn't bite.

	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Strange assignment bug (PR#1450)
Thomas Lumley