[BioC] How to convert a character string to a variable name?

James W. MacDonald jmacdon at med.umich.edu
Thu Sep 1 16:15:48 CEST 2005


Groot, Philip de wrote:
> Hello all,
> 
>  
> 
> I have the following particular problem. Consider the following two
> R/BioC commands:
> 
>  
> 
> 1. > get("1441536_at", envir=mouse4302LOCUSID)
> 
>     [1] 208715
> 
> 2. get("1441536_at", envir=sprintf("%sLOCUSID", cleancdfname(cdfName(x),
> addcdf=FALSE)))

Here is an example from GOHyperG() in the GOstats package:

  getDataEnv <- function(name, lib) {
         get(paste(lib, name, sep = ""), mode = "environment")
     }

Then you would use

get("1441536_at", getDataEnv("LOCUSID", sub("cdf$","", 
cleancdfname(cdfName(x)))))


Best,

Jim


> 
>     Error in get(x, envir, mode, inherits) : invalid 'envir' argument
> 
>  
> 
> The problem with the second command is that the 'envir' variable is
> presented as a character string. R cannot handle this and I cannot
> overcome this problem. Somehow, I must make it clear to R that this is
> not a string, but that it is a variable name. Has anyone any idea how to
> do this? This problem seems to be an obvious one, but I spent quite some
> time on this without finding a solution.
> 
>  
> 
> Regards,
> 
>  
> 
> Philip de Groot
> 
> Wageningen University
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor


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



More information about the Bioconductor mailing list