Entering edit mode
drambald
▴
80
@drambald-4243
Last seen 10.2 years ago
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.