[R] Conversion of strings to expressions

Thomas Lumley tlumley at u.washington.edu
Thu Nov 4 16:25:47 CET 2004

On Thu, 4 Nov 2004, Alexander Sokol wrote:
> Say I have a vector,
> vec<-c(1,2,3,2)
> I would like to be able to "reference" the vector by using the string
> containing the name of the vector - that is, I would like to know of some
> function which is able to convert the string "vec" into the vector vec itself.
> The purpose of this is to be able to do something like
>> somefunc("vec")==2

A) This is a FAQ

B) Many people who think they want to do this are mistaken, and they 
actually want to, for example, work with a list, one of whose elements is 
called "vec".


More information about the R-help mailing list