[Rd] R 1.3.0 bug: after "y _ 10; x[[1]] _ y", assigning to "y[1]" modifies "x" (PR#1043)
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
07 Aug 2001 22:54:53 +0200
buhr@stat.wisc.edu writes:
> After a list element has been assigned from a vector variable,
> assigments to elements of the original vector variable modify the copy
> stored in the list as well.
>
> Here's a transcript illustrating the problem:
>
> R : Copyright 2001, The R Development Core Team
> Version 1.3.0 (2001-06-22)
>
> [ . . . ]
>
> > x _ list()
> > y _ 10
> > x[[1]] _ y
> > x
> [[1]]
> [1] 10
>
> > y[1] _ 20 # should only modify "y"
> > x
> [[1]]
> [1] 20 # ACK! we modified "x", too
>
> >
>
> Kevin <buhr@stat.wisc.edu>
Confirmed with 1.3.0-patched on RedHat 7.1. For easier reproduction:
x <- list()
y <- 10
x[[1]] <- y
x
y[1] <- 20 # should only modify "y"
# y <- 20 # Works OK with this instead
x
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._