[R] how to call R from fortran?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Sep 28 18:50:51 CEST 2000

> Date: Thu, 28 Sep 2000 18:28:55 +0200 (MET DST)
> From: lfeyen at vub.ac.be (Luc Feyen)
> I have a main fortran program and within a loop of this program 
> i would like to call R. I need to transfer a rather large 
> matrix (100 by 25000) between the two codes. Can anyone suggest 
> me the most efficient way to do this or give me more general 
> information on how i can call R from my fortran program or 
> where i can find some related information. 

You can't call R from Fortran, AFAIK.  You can call R from C code
loaded into R, and if you know enough about the internals (or are using
Windows where it is documented somewhat) you can call R from a C main
program.  The types you need to use to communicate with R (C
null-terminated strings, for one) are not supported by Fortran.

Perhaps if you told us a bit more about what you actually want to
achieve we could suggest ways around this.

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