[BioC] passing in parameters to annotation packages (e.g hgu95av2)

Marc Carlson mcarlson at fhcrc.org
Mon Mar 3 18:53:10 CET 2008


Tim Smith wrote:
> Hi,
>
> I was trying to pass in a parameter (on the fly), but am unable to figure out how to get what I want. Here is what I want:
>
> xx <- as.list(hgu95av2SYMBOL)
>   
>> length(xx)
>>     
> [1] 12625
>
> However, when I try to build the string on the fly and pass it as a parameter, for example:
>
>   
>> var <- 'hgu95av2'
>> tempVar <- paste(var,'SYMBOL',sep='')
>> yy <- as.list(tempVar)
>> length(yy)
>>     
> [1] 1
>   
>> tempVar
>>     
> [1] "hgu95av2SYMBOL"
>
>
> I understand that in the second case, I have just created a string and the results are not surprising!. But how do I get it to do what I really want?
>
>
>
>
>
>
>
>       ____________________________________________________________________________________
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>   
Hi Tim,

I think that the function you want to use is get().

So for your example:

var <- 'hgu95av2'
tempVar <- paste(var,'SYMBOL',sep='')

#just add this function call into your flow to find the variable that
you seek
#(instead of the string which as you mentioned will NOT be what you want):
foo = get(tempVar)

yy = as.list(foo)
length(yy)

#Which gives the answer that I think you wanted:  [1] 12625


Let me know if this doesn't help,


    Marc



More information about the Bioconductor mailing list