Re: [R] Thanks!

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Thu, 03 Jul 2008 11:14:37 -0500

on 07/03/2008 10:35 AM R_Learner wrote:
> Thanks guys!
> I think [[ seems to be the easier way, but I also spent an hour (while my
> post was pending approval) to find that the following also works:
>
> temp<- eval(parse(text=paste("data$column_title"")))

To quote Thomas:

 > fortune("parse()")

If the answer is parse() you should usually rethink the question.

:-)

In general, you should look at other means such as using assign() or get(), which in this case could be something like:

MyCol <- "Sepal.Length"

 > with(iris, get(MyCol))
   [1] 5.1 4.9 4.7 4.6 5.0 5.4 4.6 5.0 4.4 4.9 5.4 4.8 4.8 4.3 5.8 5.7   [17] 5.4 5.1 5.7 5.1 5.4 5.1 4.6 5.1 4.8 5.0 5.0 5.2 5.2 4.7 4.8 5.4 ...

See ?assign, ?get and ?with

To further quote "Yoda":

 > fortune("Yoda")

Evelyn Hall: I would like to know how (if) I can extract some of the information from the summary of my nlme. Simon Blomberg: This is R. There is no if. Only how.

Regards,

Marc



R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 03 Jul 2008 - 16:20:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jul 2008 - 20:31:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive