[R] Folding ?

Yves Gauvreau cyg at sympatico.ca
Sun Sep 24 17:55:12 CEST 2000


I need to write a function that would look something like this:

 S <- function(b=betas){
     expression(b[1] * f(b[2] * x * f(b[3] * x * f(...b[n-1] * x * f(b[n] *

Where n is the number of element in b.

Further I need to be able to evaluate S at some x numerically of course and
I need to use "deriv" and produce dS/dx such that I can evaluate it also at
some x.

I tried building the S expression manually to test the deriv (D) function,
evaluate them both and everything work's fine.

My trouble is automating the building of the expression S that is dependent
on the length of b.

Any suggestion are welcome.

Thanks in advance.

Yves Gauvreau

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list