Dynamic Function creation
0
0
Entering edit mode
drambald ▴ 80
@drambald-4243
Last seen 10.1 years ago
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
• 721 views
ADD COMMENT

Login before adding your answer.

Traffic: 867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6