passing in parameters to annotation packages (e.g hgu95av2)
2
0
Entering edit mode
Tim Smith ★ 1.1k
@tim-smith-1532
Last seen 10.2 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20080303/ 8cc4e237/attachment.pl
• 248 views
ADD COMMENT
0
Entering edit mode
Marc Carlson ★ 7.2k
@marc-carlson-2264
Last seen 8.3 years ago
United States
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
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 3 months ago
United States
On Mon, Mar 3, 2008 at 12:14 PM, Tim Smith <tim_smith_666 at="" yahoo.com=""> 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? Close! You just missed one step (see ?get): > library(hgu95av2) > var <- 'hgu95av2' > tempVar <- paste(var,'SYMBOL',sep='') > y <- get(tempVar) > yy <- as.list(y) > length(yy) [1] 12625 Hope that helps. Sean
ADD COMMENT

Login before adding your answer.

Traffic: 868 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6