[R] Calling R from external code?

Yves Gauvreau cyg at sympatico.ca
Tue Jan 23 02:47:55 CET 2001

Hi every one,

I'm thinking of using some optimization algorithm in conjunction with R
1.2.[01]. I assume that it is usual for this kind of code be given a pointer
to the function to be optimize and a bunch of parameters for both the
algorithm and for the function. In order to be flexible the ideal would be
to be able to write the function to be optimize as a R function. But...

I got myself a copy of "S programming" (I got it from Amazon while it was at
~ $17.98) and I read chapter 6 (6.3). I also read "Writing R extensions".
>From what I've read the authors basically suggest to forget that and the
main reason they give is that the process can be "extremely slow". I even
took a look at optim.c which does exactly what I would like to be able to do
for this algorithm. I also got my hand on the Fortran code for L-BFGS-B from
R. H. Byrd, P. Lu, J. Nocedal and C. Zhu (NETLIB) and they also have the
same example program as R (the extended Rosenbrock function). As expected
the Fortran program is a lot faster.

The functions I would like to optimize will probably be a lot of work for
both the algorithm and within the functions themselves. So this is kind of a

Is the only alternative to this situation is writing the function to be
optimized as external code and setting up things such that the process can
be initiated from an R function?

Thanks in advance, any suggestion(s) are welcome.

Yves Gauvreau
B.E.F.P. Université du Québec à Montréal
cyg at sympatico.ca

platform i386-pc-mingw32
arch     x86
os       Win32
system   x86, Win32
major    1
minor    2.0
year     2000
month    12
day      15
language R

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