# The NAGFWrappers R Package

The NAGFWrappers R package consists of a series of R functions calling a number of routines from the optimization chapters (E04 and E05) of the NAG Fortran Library. In addition to the optimization routines there are a few nearest correlation matrix solvers and some routines from the special functions chapter to give examples of parameter types (such as complex numbers). The package has been automatically generated from the NAG documentation, according to the guidelines explained in the articles R under Windows and R Using callback functions.

The package includes documentation in the “Rdoc” style which will produce help pages within the R system as well as in HTML and PDF.

The interface code is being released as source under the Artistic Licence, and we welcome feedback on the package, especially comments on further areas of the Library that would be required.

The details of the optimization chapters can be found in the introductions to the E04 and the E05 chapters of the NAG Library and you are advised to make use of the Chapter Introductions and Decision Trees within the introductions to choose the most appropriate NAG function.

This package is supplied as is and whilst it has been built and tested on 64 bit Linux64, Windows 32-bit and Windows 64-bit, the R package has not been through the complete NAG QA procedures of fully supported NAG products. We are keen to get user feedback and will respond to technical queries and problem reports via support@nag.co.uk.

### Mark 24

• Linux users should download the R source package. This has been tested with the NAG Fortran Library for 64-bit Linux, at Mark 23 (FLL6I23DC implementation) and Mark 24 (FLL6I24DC implementation). This source package has also been tested on 32- and 64-bit Windows, but Windows users are recommended to pick up the pre-built packages below.
• R binary package for R 3.1.2 Windows 32-bit (Compiled/tested with the FLDLL244M implementation of the NAG Library) or Windows 64-bit (Compiled/tested with the FLW6I24DC implementation of the NAG Library).

### Mark 23

• Linux users should download the R source package. This has been tested with the NAG Fortran Library for 64-bit Linux, FLL6I23DC implementation. This source package has also been tested on 32- and 64-bit Windows, but Windows users are recommended to pick up the pre-built packages below.
• R binary package for R 2.13, Windows 32-bit (Compiled/tested with the FLDLL234M implementation of the NAG Library). Note this may also be used with the 32-bit implementation of R on Windows 64-bit.
• R binary package for R 2.13, Windows 64-bit (Compiled/tested with the FLW6I23DC implementation of the NAG Library).

## Installation

The NAGFWrappers package has been built using the standard R packaging mechanism and it can be installed using standard R commands as described in the R package manual. The Library may then be accessed using the R command:

library("NAGFWrappers")

The NAGFWrappers package requires a licensed NAG Fortran Library to be installed on your system. It should be automatically located during the installation of the package, but if it has been installed in a non standard location, you may need to set the environment variables NAG_LIBRARY_PATH and LD_LIBRARY_PATH to the correct paths.

## Checking the installation and running examples

After installation, you may run the command:

R CMD check NAGFWrappers


which will run R's standard test program, including all the example programs.

Every function in the package has an R example program that has been included in the Rdoc file. They may be run individually within R using the example command. For example: example(e04uc) will run the example for the E04UC routine.

You may want to try the a00ad command in R, which calls the A00ADF routine and will return which underlying Fortran implementation is being used.