When you assign a value to an object which exists in some database on
the search list, R creates a copy in the current environment. However,
if the object is a list or vector, and you assign a new value to one of
its elements, a copy is not made and the assignment fails (with no error
message!). This behaviour is incompatible with S-PLUS, which will make
a copy of the object before modifying one of its elements.
Martyn
> exists("alist", 1, inherits=F)
[1] FALSE> mydata <- list(alist = list(one=1,two=1))
> attach(mydata)
> alist
$one
[1] 1
$two
[1] 1
> alist$one <- 2
> alist[[2]] <- 3
> alist
$one
[1] 1
$two
[1] 1
> exists("alist", 1, inherits=F)
[1] FALSE
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-