[R] evaluating and walking in names

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Thu Aug 7 11:24:32 CEST 2003


On 07-Aug-03 Thomas Lumley wrote:
> On Wed, 6 Aug 2003 Ted.Harding at nessie.mcc.ac.uk wrote:
> To get the X1 component of my.data you would need
> eval(parse(text="my.data$X1"))
>> my.data<-data.frame(X1=1:2,X2=2:3)
>> parse(text="my.data$X1")
> expression(my.data$X1)
>> eval(parse(text="my.data$X1"))
> [1] 1 2

Of course! Thanks, Thomas.
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 07-Aug-03                                       Time: 10:24:31
------------------------------ XFMail ------------------------------




More information about the R-help mailing list