Re: [R] Thanks!

From: R_Learner <sschiang8_at_gmail.com>
Date: Thu, 03 Jul 2008 13:08:53 -0700 (PDT)

Haha I'll definitely keep that in mind...parse does complicated things.

Marc Schwartz wrote:
>
> 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.
> -- Thomas Lumley
> R-help (February 2005)
>
> :-)
>
> 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.
> -- Evelyn Hall and Simon 'Yoda' Blomberg
> R-help (April 2005)
>
>
> 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.
>
>
-- 
View this message in context: http://www.nabble.com/Accessing-a-field-in-a-data-fram-tp18244661p18267340.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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 - 20:19:45 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 - 21:32:09 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