[Rd] Strange assignment bug (PR#1450)

Thomas Lumley tlumley@u.washington.edu
Wed, 10 Apr 2002 09:29:07 -0700 (PDT)


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._