[R] Help needed understanding eval,quote,expression

From: <toby_marks_at_americancentury.com>
Date: Thu 29 Jun 2006 - 12:18:51 EST

I am trying to build up a quoted or character expression representing a component in a list in order to reference it indirectly. For instance, I have a list that has data I want to pull, and another list that has character vectors and/or lists of characters containing the names of the components in the first list.

It seems that the way to do this is as evaluating expressions, but I seem to be missing something. The concept should be similar to the snippet below:

For instance:

$x = list(y=list(y1="hello",y2="world"),z=list(z1="foo",z2="bar"))
$y = quote(x$y$y1)

[1] "hello"

but, I'm trying to accomplish this by building up y as a character and then evaluating it, and having no success.


[1] "x$y$y1"

How can I evaluate y1 as I did with y previously? or can I?

Much Thanks !

CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 29 17:25:03 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 29 Jun 2006 - 22:12:34 EST.

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