[R] a string to enviroment or function

Weiwei Shi helprhelp at gmail.com
Mon Jun 25 22:19:20 CEST 2007


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



More information about the R-help mailing list