[R] Change in how R handles assignments?

David Kreil kreil at ebi.ac.uk
Mon May 17 21:48:12 CEST 2004


Dear Prof Brian Ripley,

Thank you very much for your fast and helpful answer!


> > I have been using the following code in earlier versions of R:
> 
> What `earlier versions'?  As far as I know this was changed in 1.8.0.

Yes, that fits my observations. We have an old 1.7.1-beta installation and a 
newer 1.8.1; the "old" code runs on the 1.7.1 but not on the 1.8.1.

> >   q[,names(info)]<-info[no,];
> You do not need to terminate lines in ;, BTW.
Thanks! A "bad" C-habit, I suppose.

> But that was not what was documented.  The intention is that the rhs be a 
> list, not a data frame.

Ah! Is
  q[,names(info)]<-c(info[no,]);
a good way of writing it then? It seems to work.


> You can do
> x[, names(info)] <- unclass(info[1, ])

Great, thanks! Is there any advantage of using unclass() vs c()?

> We'll unclass a data frame rhs internally in future.

Does that mean that the "old" 1.7.1 code will work again in future R releases? 
That would save me from fixing quite a number of our R programs (we'd stick to 
the 1.7.1 with the old code in the mean time).

With many thanks again for your help,

David Kreil.

------------------------------------------------------------------------
Dr David Philip Kreil                 ("`-''-/").___..--''"`-._
Research Fellow                        `6_ 6  )   `-.  (     ).`-.__.`)
University of Cambridge                (_Y_.)'  ._   )  `._ `. ``-..-'
++44 1223 764107, fax 333992         _..`--'_..-_/  /--'_.' ,'
www.inference.phy.cam.ac.uk/dpk20   (il),-''  (li),'  ((!.-'




More information about the R-help mailing list