Re: [R] Change in how R handles assignments?

About this list Date view Thread view Subject view Author view Attachment view

From: David Kreil (kreil@ebi.ac.uk)
Date: Tue 18 May 2004 - 05:48:12 EST


Message-id: <200405171948.i4HJmCH06393@puffin.ebi.ac.uk>


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),' ((!.-'

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST