[R] I don't understand this

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Sep 2 17:47:08 CEST 2003


Thomas Lumley <tlumley at u.washington.edu> writes:

> I would have said that the behavior of
>    (if (cond) names else dim)(x) <- 10
> is undefined in the S language, along with things like the order of
> evaluation of the apply functions.

Actually, following Luke's analysis, I think it is pretty squarely an
error, which we just weren't quite good enough at detecting... 

BTW: If you ever actually need to do something like that, try

eval(substitute(foo(x)<-10,list(foo=as.name(if (cond) "names" else "dim")))) 


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list