Re: [R] Running Fortran code from R

From: Duncan Murdoch <>
Date: Tue, 26 Apr 2011 10:34:34 -0400

On 26/04/2011 8:19 AM, A.Noufaily wrote:
> Dear R users,
> I have a Fortran code that I would like to compile and call from R later.
> I have never worked with Fortran before. Does anyone know the steps to create Fortran DLLs for R on a Windows PC.
> Is anyone aware of a manual (or does anyone know how to) that explains:
> - What tools and software I need to download for that
> - How to set the paths in my PC
> - What Fortran Version is the best to have in this case

Download the Rtools from It includes all the tools you'll need.

> - How to produce DLLs
> - How to load the code in R

The best way is to create a package, and put the Fortran code in the src directory of the package, e.g. in pkgname/src. Then "R CMD INSTALL pkgname" will do all the work for you.

Duncan Murdoch

> I would really appreciate it if someone can help me.
> Kind Regards,
> Amy
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 26 Apr 2011 - 14:38:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 15:00:33 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive