[BioC] Question about turning strings into variable names in R

James W. MacDonald jmacdon at med.umich.edu
Thu Mar 1 13:34:07 CET 2007


Hi Jose,

J.delasHeras at ed.ac.uk wrote:
> Hi,
> 
> I have a situation where I have a vector of variable names. If I call  
> any of them, I get a text string (the name is surrounded by ""). How  
> can I use that as a variable name again?
> 
> For instance, I have objects a, b and c, and a vector v<-c("a","b","c").
> If I want to return the contents of a, I can't do just v[1], because  
> that only shows "a"...
> Is there a simple way to indicate that "a" should be taken as the name  
> of an object, and not as a string? If so, I haven't found it...

I think you want get() here.

get(v[1])

Best,

Jim


> 
> thanks!
> 
> Jose
> 


-- 
James W. MacDonald
University of Michigan
Affymetrix and cDNA Microarray Core
1500 E Medical Center Drive
Ann Arbor MI 48109
734-647-5623



**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list