Hi, I am wondering how to make a function Fun to make the following work: t0 <- (paste("hgu133a", "ENTREZID", sep="")) xx <- as.list(Fun(t0)) # make it work like xx<-as.list(hgu133aENTREZID) thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
I think that you might want: t0 <- (paste("hgu133a", "ENTREZID", sep="")) xx <- as.list(get(t0)) # make it work like xx<-as.list(hgu133aENTREZID) On 6/25/07, Weiwei Shi <helprhelp@gmail.com> wrote:> > Hi, > > I am wondering how to make a function Fun to make the following work: > > t0 <- (paste("hgu133a", "ENTREZID", sep="")) > xx <- as.list(Fun(t0)) # make it work like xx<-as.list(hgu133aENTREZID) > > thanks, > -- > Weiwei Shi, Ph.D > Research Scientist > GeneGO, Inc. > > "Did you always know?" > "No, I did not. But I believed..." > ---Matrix III > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]]
then how to do this f1 <- function(mylab){ library(mylab) ... } it seems that if you call library("hgu133a") # which is file # but library(mylab) # even you pass "hgu133a" as parameter, it still complains about "mylab" does not exist. It seems that it consider mylab as package instead of its value. On 6/25/07, jim holtman <jholtman at gmail.com> wrote:> I think that you might want: > > t0 <- (paste("hgu133a", "ENTREZID", sep="")) > xx <- as.list(get(t0)) # make it work like xx<-as.list(hgu133aENTREZID) > > > > > On 6/25/07, Weiwei Shi <helprhelp at gmail.com> wrote: > > > > Hi, > > > > I am wondering how to make a function Fun to make the following work: > > > > t0 <- (paste("hgu133a", "ENTREZID", sep="")) > > xx <- as.list(Fun(t0)) # make it work like xx<-as.list(hgu133aENTREZID) > > > > thanks, > > -- > > Weiwei Shi, Ph.D > > Research Scientist > > GeneGO, Inc. > > > > "Did you always know?" > > "No, I did not. But I believed..." > > ---Matrix III > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem you are trying to solve?-- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
On 25/06/2007 4:19 PM, Weiwei Shi wrote:> then how to do this > > f1 <- function(mylab){ > library(mylab) > ... > } > > it seems that if you call > library("hgu133a") # which is file > # but > library(mylab) # even you pass "hgu133a" as parameter, it still > complains about "mylab" does not exist. It seems that it consider > mylab as package instead of its value.One of the examples in ?library shows how to do what you want. pkg <- "splines" library(pkg, character.only = TRUE) Duncan Murdoch>>> Weiwei Shi, Ph.D >>> Research Scientist >>> GeneGO, Inc.P.S. If you think this was helpful, one of the ways to contribute back to the R project would be to ask your employer to become an institutional member: see http://www.r-project.org/foundation/membership.html