[BioC] How to use a string as an environment name in mget?

Wolfgang Huber huber at ebi.ac.uk
Fri Dec 15 14:48:35 CET 2006


get(env) will be an environment if env is the name of an environment.

 Best wishes

Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber

Jarno Tuimala wrote:
> Dear all,
> Is it possible to use a string as an environment name in mget? I was 
> trying to do this with the following script, but it says that the second 
> argument for mget is not an environment. Well, I know it isn't, since it 
> was generated using paste function, so it's class is character.
>> genes<-c("1007_s_at", "1053_at", "117_at", "121_at")
>> chip<-"hgu133a"
>> library(package=chip, character.only=T)
>> env<-paste(chip, "REFSEQ", sep="")
>> refseq<-as.vector(unlist(mget(genes, envir=env)))
> Error in mget(x, envir, mode, ifnotfound, inherits) :
>          second argument must be an environment
> The following works fine:
>> refseq<-as.vector(unlist(mget(genes, envir=hgu133aREFSEQ)))
> But, I'm trying to put together a script I could easily just source for 
> different datasets, so I would like to avoid typing the name of the 
> environment every time (I read the name of the Affymetrix chip set from a 
> second file in the actual script).
> Best regards,
> Jarno Tuimala

More information about the Bioconductor mailing list