[R] Fortran Code in R

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 18 11:25:24 CEST 2000


> Date: Thu, 18 May 2000 08:46:49 +0200
> From: Alexey Botvinnik <abotvin at gwdg.de>
> 
> Hello everyone,
> 
> I would appreciate any help on how to make FORTRAN programs work with
> R.  The problem is that there is a lot of FORTRAN code and now there's
> a need to use this code from R.  I looked into R-Writing Extensions
> Manual, but there's not a lot on this, and what there is, is not quite
> clear.  So please, if anyone had the same problem and solved it
> succesfully, let me know (the simpler the solution instruction will be
> the better).

If you want to use Fortran programs in R under Unix use

$ R SHLIB -o myprogs.so prog1.f prog2.f prog3.f
$ R
> dyn.load("myprogs.so")

[On a very few systems it might need to be .sl not .so.]

If you get no errors, that's all that is needed *except* interfacing the
code to R via .Fortran calls.   There is quite a bit on that, and it
can be tricky.  (S books will help your there, though.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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