[BioC] Dynamic Function creation

Davide Rambaldi davide.rambaldi at ifom-ieo-campus.it
Thu Mar 10 12:36:47 CET 2011


Ehm sorry I made a mistake in my example:

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

c <- a + b

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

Regards

On Mar 10, 2011, at 12:23 PM, Davide Rambaldi wrote:

> Hello, may be is not the correct place to ask this but: it is possible to create functions in R dynamically? 
> 
> (May be the correct name is anonymous functions ....)
> 
> I want something like:
> 
> a <- function(parS,xx) { parS$a^2 + parS$M }
> b <- function(parS,xx) { parS$b^2 + parS$M }
> 
> c <- a + b
> 
> where c is:
> 
> function(parS,xx) {  parS$a^2*exp(-((xx-parS$M)^2)/(2*parS$S^2))  + parS$b^2*exp(-((xx-(parS$M - parS$D))^2)/(2*parS$S^2)) }
> 
> Regards
> 
> 
> Davide R.
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

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