[Rd] Using gsl libraries in R packages

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Sep 16 21:17:03 CEST 2007


On Sun, 16 Sep 2007, Michael Braun wrote:

> I have some compiled C code that I call from R, and I would like to
> distribute this code as an R package through CRAN.  In the C code, I use the
> gsl numerical libraries, mainly for the BLAS interface, some linear algebra
> functions, and some optimization routines.  As I prepare this code to
> conform to the specs for R packagtes, I am wondering if there is a
> restriction on the use of external libraries in R packages, or am I limited
> to those functions in the R API (or, in other words, do I need to convert my
> gsl function calls to R API function calls)?  I have sifted through the R
> documentation on this matter, but I could not find a clear answer.

You can have whatever dependencies you like, but

1) Please note them in SystemRequirements in your DESCRIPTION file.

2) Just be aware that this reduce the potential user base dramatically. If 
you only need a few gsl functions it would be better to copy them into 
your package.  I have to say that I think for most of what you quote R has 
better functionality than gsl does: e.g. why would you want to use a 
third-party BLAS interface?

3) We already have a CRAN package 'gsl' that makes wrappers to some gsl 
routines.  I supply a Windows binary for it, and that is not too much of a 
pain these days (it was once), provided you make clear which version of 
gsl is required.

> And, on a related note, is there any documentation on the use of R API
> functions, especially those listed in the Rinternals.h header?  Many of
> these functions look like they might be useful, but I cannot find a
> description of what they do, what the arguments are, and so forth.  Is
> examining the source code directly the only way?

If they are API, they are documented in 'Writing R Extensions'. 
Otherwise, note the comments in `Writing R Extensions' that many are 
subject to change without notice.  We do try to run checks over CRAN and 
not make gratuitous changes, but the effort of doing so is getting large.

>
> Thanks,
>
> Michael
>
>
>
> Michael Braun
> Assistant Professor of Marketing
> MIT Sloan School of Management
> One Amherst St., E40-169
> Cambridge, MA 02142
> (617) 253-3436
> braunm at mit.edu
>
>
> 	[[alternative HTML version deleted]]

PLEASE do follow the posting guide.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list