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@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.