Interfacing R and compiled languages

Automated postprocessing of results
from ADMB, C++, and Fortran

Landings graph

Please read the notices at the bottom of this page.

Linking ADMB, C++, or Fortran and R

Fishery science is not unique in needing to postprocess model results. Because computer modeling can be time consuming, it often is useful to separate modeling from postprocessing, such as graphics generation and forecasting.

Our team has developed middleware to interface modeling codes to the statistics package R. We use our interface for several purposes:

Some of our criteria in choosing an approach were—

Our initial work was in interfacing AD Model Builder (ADMB; a commercial optimization and model building package and a C++ code generator) to R.  We have since implemented our interface in Fortran 95, to work with models written in Fortran 77 or 95, and in C, to work with models written in C or C++.

We call the packages For2R, C2R, and ADMB2R. We use the name X2R for all three of them.

Downloads

Output routines in three languages (X2R):   Download For2R, C2R, and ADMB2R [as a ZIP file] or [as a tar.gz file].  Each download includes source code, user's guides, and examples for each language. Download size: about 500Kb.

Due to the libraries used by AD Model Builder, ADMB2R is known to work only with the free Borland C++ compiler.

Automated graphics (FishGraph):  To work with the above, we offer a beta-test version of our of R functions, FishGraph, to graph output from fish stock-assessment models.  When model output is structured according to simple guidelines, FishGraph can make and save hundreds of plots in a few seconds. [Download FishGraph installer for Windows] (size: about 1.2Mb).

If you want to try FishGraph on other platforms, our graphics code can be supplied without the Windows installer. It will require minor modification to save files. Please contact me by email.

Talk:  Download a presentation (PDF) on our interface between compiled languages and R.

Related links (non-NMFS sites)

R Project

The R Project for Statistical Computing. Links to documentation and download of R.

g95 Project

An open-source Fortran 95 compiler. The language includes all of Fortran 77 and many new features, including whole-matrix operations.

gfortran Project

Another open-source Fortran 95 compiler.

Otter Research Ltd

Developer and supplier of AD Model Builder software.

Insightful Corporation

Developer and supplier of the commercial S-Plus software. This implements a dialect of the S language similar to R.


Notice of nonendorsement: NMFS does not approve, recommend, or endorse products or materials mentioned here. No reference shall be made to NMFS, or to this Web page, in any advertising or sales promotion which would indicate or imply that NMFS approves, recommends, or endorses any products or materials mentioned here, or which has its its purpose an intent to cause directly or indirectly the advertised product to be used or purchased because of this NMFS Web page.

Notice of software status: Software available from this page is offered for research and evaluation purposes only. No warranty of suitability or correct operation is made or implied. Software available from non-NMFS sites is described for the reader's information only, and no endorsement is made or implied.