Hi, I work with bio-conductor, but this is probably a basic R question. I want to emulate the GOBPOFFSPRING$"GO:0008150" command:> allBP <- GOBPOFFSPRING$"GO:0008150" > class(allBP)[1] "character"> length(allBP)[1] 16066>I want to create a function so that I can execute the command by passing as a parameter the portion in quotes in the above command (""GO:0008150"). So my current function looks like:> str <- "GO:0008150" > ifunc <- function(str){+ allBP <- paste('GOBPOFFSPRING$',str,sep='') + return(allBP) + }> x <- ifunc(str) > class(x)[1] "character"> length(x)[1] 1>But this just returns a string. How do I get the command to execute? thanks! [[alternative HTML version deleted]]
Try this: ifunc <- function(str){ allBP <- GOBPOFFSPRING[[str]] return(allBP)} On Sat, Jul 4, 2009 at 1:38 PM, Paul Evans <p.evans48@yahoo.com> wrote:> Hi, > > I work with bio-conductor, but this is probably a basic R question. > > I want to emulate the GOBPOFFSPRING$"GO:0008150" command: > > > > allBP <- GOBPOFFSPRING$"GO:0008150" > > class(allBP) > [1] "character" > > length(allBP) > [1] 16066 > > > > I want to create a function so that I can execute the command by passing as > a parameter the portion in quotes in the above command (""GO:0008150"). So > my current function looks like: > > > str <- "GO:0008150" > > ifunc <- function(str){ > + allBP <- paste('GOBPOFFSPRING$',str,sep='') > + return(allBP) > + } > > x <- ifunc(str) > > class(x) > [1] "character" > > length(x) > [1] 1 > > > > But this just returns a string. How do I get the command to execute? > > thanks! > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
You probably want: str <- "GO:0008150" ifunc <- function(str){ allBP <- GOBPOFFSPRINGS[[str]] return(allBP) } On Sat, Jul 4, 2009 at 12:38 PM, Paul Evans<p.evans48 at yahoo.com> wrote:> Hi, > > I work with bio-conductor, but this is probably a basic R question. > > I want to emulate the GOBPOFFSPRING$"GO:0008150" command: > > >> allBP <- GOBPOFFSPRING$"GO:0008150" >> class(allBP) > [1] "character" >> length(allBP) > [1] 16066 >> > > I want to create a function so that I can execute the command by passing as a parameter the portion in quotes in the above command (""GO:0008150"). So my current function looks like: > >> str <- "GO:0008150" >> ifunc <- function(str){ > + allBP <- paste('GOBPOFFSPRING$',str,sep='') > + return(allBP) > + } >> x <- ifunc(str) >> class(x) > [1] "character" >> length(x) > [1] 1 >> > > But this just returns a string. How do I get the command to execute? > > thanks! > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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 that you are trying to solve?
Hi Paul -- Paul Evans wrote:> Hi, > > I work with bio-conductor, but this is probably a basic R question. > > I want to emulate the GOBPOFFSPRING$"GO:0008150" command: > > >> allBP <- GOBPOFFSPRING$"GO:0008150" >> class(allBP) > [1] "character" >> length(allBP) > [1] 16066 > > I want to create a function so that I can execute the command by passing as a parameter the portion in quotes in the above command (""GO:0008150"). So my current function looks like: > >> str <- "GO:0008150" >> ifunc <- function(str){ > + allBP <- paste('GOBPOFFSPRING$',str,sep='') > + return(allBP) > + } >> x <- ifunc(str) >> class(x) > [1] "character" >> length(x) > [1] 1 > > But this just returns a string. How do I get the command to execute?use GOBPOFFSPRING[[str]]. It is in some ways a general R question, but actually GOBPOFFSPRING is an instance of a class with specialized functionality, and you'll better advice about it on the Bioconductor mailing list. Martin> > thanks! > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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.
Reasonably Related Threads
- RFC: __attribute__((ifunc("resolver")) representation in LLVM IR
- RFC: __attribute__((ifunc("resolver")) representation in LLVM IR
- RFC: __attribute__((ifunc("resolver")) representation in LLVM IR
- RFC: __attribute__((ifunc("resolver")) representation in LLVM IR
- [lld] avoid emitting PLT entries for ifuncs