[R] Running Fortran code from R

Duncan Murdoch murdoch.duncan at gmail.com
Tue Apr 26 16:34:34 CEST 2011


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 murdoch-sutherland.com/Rtools.  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
>



More information about the R-help mailing list