[BioC] Dynamic Function creation

Davide Rambaldi davide.rambaldi at ifom-ieo-campus.it
Fri Mar 11 10:50:05 CET 2011


Hi all

> Ciao Davide,
> 
> does this do it?
> 
> c <- function(parS, xx) { a + b }
> 

Something similar:

this seems to work:

 a <- function(parS,xx) { parS$a^2 + parS$M }
 b <- function(parS,xx) { parS$b^2 + parS$M }


# note the args for a and b (otherwise give error)
 c <- function(parS,xx) { a(parS,xx) + b(parS,xx) }

parS <- list(a = 100, M=10, b=1000)
x <- 1:100

c(parS,x)
[1] 1010020


And it works.

Sorry if it was off-topic and also silly question.... :-)

Best Regards and thanks for help

Davide





> J.
> 
> On 03/10/2011 12:36 PM, Davide Rambaldi wrote:
>> a<- function(parS,xx) { parS$a2  + parS$M }
>> b<- function(parS,xx) { parS$b2  + parS$M }
>> 
>> c<- a + b

Davide Rambaldi, Bioinformatics PostDoc.
-----------------------------------------------------
IFOM-IEO Campus
Via Adamello 16, Milano
I-20139 Italy
[t] +39 02574303870
[e] davide.rambaldi at ifom-ieo-campus.it



More information about the Bioconductor mailing list