A lot of numerical programs are still written in Fortran. When I programmed Fortran 18 years ago, it felt to much like Basic. Soon I switched to C and later to C++, to forget all about that later again. Now, if I think about it: Fortran manages to get the performance of C with the simplicity of Basic. That is not a bad deal, if I think about it now.
I wanted to do some Fortran or C programming for R for quite a while. On this page a simple start is given: http://www.r-bloggers.com/fortran-and-r-speed-things-up/ I want to add a little Fortran help to it.
Diving into C/C++ or Fortran can be a bit ackward. A fast way to start out turns out to be Netbeans. Netbeans supports C/C++ and Fortran, there even is a special C/C++ version at netbeans.org; it uses make to drive the build process. Dowload and install Netbeans C/C++ and install gfortran. Choose New Project -> C/C++ Dynamic Library, name it ‘facto’ and choose Fortran as language in the next step. Paste the source of the mentioned article as facto.f in the source files section. Switch to ‘Release’ in the toolbar and right click on the ‘facto’ project node to create a build. Presto, you can see the build running in the bottom right. A dynamically linked library is built.
Open R-Studio, create a function that calls the library, and factorial 5 is …