problem with "[[<-" (PR#306)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
02 Nov 1999 11:55:32 +0100


saikat@stat.wisc.edu writes:

> This works in 0.65.1 but not in 0.90.0.
> 
> > form <- ~ a | b
> > form[[2]][[3]] <- as.name("u")
> Error: Object "u" not found

Ow! Obviously, eval() is called once too many. Robert?

The problem is that one gets to

"[[<-"(*tmp*, 3, value = u)

and the evaluator naturally tries to evaluate u.

> I can get around this as follows
> 
> > form.1 <- form[[2]]
> > form.1[[3]] <- as.name("u")
> > form[[2]] <- form.1
> > form
> ~a | u

..or form[[2]][[3]]<-quote(quote(u)), but that one is not likely to
last through a bugfix.

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