[R] (no subject)

Francisco J Molina anilomjf at yahoo.es
Wed Dec 13 13:39:16 CET 2006


Hi,

Let us suppose I have a list 

x = list ()
x $ name1 = 1
x $ name2 = 'a'

in the work environment.

Let us suppose that in the body of a function I want to acces to a component of x by
using its name as argument of that function. How can this by done? For instance, I was
expecting

f = function ( name ) x $ name

to output 

1 ( that is, x $ name1 )

when I command f ( name1 ) or f ( 'name1' ), but that is not happening. Does anyone knows
how I can fix f to give me x $ name, while the argument is still the name of the
component of x?

Thank you.



More information about the R-help mailing list