R: Argument processing and general info

Misc {gsl} | R Documentation

## Argument processing and general info

### Description

Various widely used functions in the package

### Usage

    process.args(...)
    strictify(val,status)

### Arguments

`...` | Argument list to be coerced to the same length
`val` | Value component of `&result`
`status` | status integer

### Details

Function `process.args()` is an internal function used to massage the arguments into a form suitable for passing to `.C()`. For example, in function `hyperg_0F1(c,x)`, one wants each of `hyperg_0F1(0.1, c(0.3,0.4))` and `hyperg_0F1(c(0.1,0.2), 0.3)` and `hyperg_0F1(c(0.1,0.2),c(0.3,0.4))` to behave sensibly.

Function `process.args()` is used widely in the package, taking an arbitrary number of arguments and returning a list whose elements are vectors of the same length. Most of the special functions use `process.args()` to ensure that the returned value takes the attributes of the input argument with most elements where possible.

Function `strictify()` uses the `status` value returned by the “error” form of the GSL special functions to make values returned with a nonzero `error` a `NaN`. In most of the special functions, `strictify()` is called if argument `strict` takes its default value of `TRUE`. Setting it to `FALSE` sometimes returns a numerical value as per the GSL reference manual.

In most of the special functions, if argument `give` takes its default value of `FALSE`, only a numerical value is returned. If `TRUE`, error information and the status (see preceding paragraph) is also returned.

Following tips found on R-devel:

1. Download and extract source code of R-package gsl

2. Use `gsl-config --libs` to get the path to GSL's lib directory (`-L<path-to-lib>`), use `gsl-config --cflags` to get the path to `GSL`'s include directory (`-I<path-to-include>`)

3. Change `Makevars` in `gsl/src`:

   - Add `-L<path-to-lib>` to `PKG_LIBS`

   - Add (new) line: `PKG_CPPFLAGS=-I<path-to-include>`

4. Install `gsl` via

   `LDFLAGS=-L<path-to-lib>; export LDFLAGS`

   `CPPFLAGS=-I<path-to-include>;export CPPFLAGS`

   `R CMD INSTALL gsl`

### Author(s)

Robin K. S. Hankin

### References

http://www.gnu.org/software/gsl

[Package gsl version 1.9-10.3 Index]