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

Jarno Tuimala jtuimala at csc.fi
Fri Dec 15 14:26:13 CET 2006


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