[R] Thanks!
R_Learner
sschiang8 at gmail.com
Thu Jul 3 22:08:53 CEST 2008
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.
More information about the R-help
mailing list