[Rd] extending package with function calling an Objective Caml program

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 21 10:21:14 CEST 2007


On Wed, 20 Jun 2007, Tamara Steijger wrote:

> Hallo,
>
> we are trying to extend the R package multcompView in agreement with
> the author Hans-Peter Piepho. The function multcompLetters implements
> so far a heuristic. We would like to add a function that implements
> an exact algorithm and returns a provable optimum result. This
> algorithm has been implemented in Objective Caml and we would like to
> reuse this code. We wrote an R function that accepts the same input
> as the original function and provides the same result format. But
> this function calls the Obejctive Caml executable. This means that if
> the package is extended with this function the Objective Caml code
> has to be included as well and one needs to assure that it is
> compiled the right way if the package is loaded.
>
> Unfortunately are we not that familiar with R and could not find
> corresponding information in the documentation. Does somebody know if
> something as described above is possible? And where information could
> be found about how to do it?

It is possible, and the information is in 'Writing R Extensions'.

You would need to use configure to test if an OCaml compiler was 
installed, a src/Makefile to arrange to compile the executable and put it 
under inst/ so it would get installed.

Having said that, the chances that an R user would have an OCaml compiler 
installed seem to me to be very low, and it might be better to arrange to 
distribute pre-compiled versions of your package for platforms for which 
you can build it: preferably i686 and x86_64 Linux, Windows and MacOS X.

A variation on the last approach is to include prebuilt executables in the 
source package, and get configure to choose the right one to be installed 
if no OCaml compiler was found.


> Thanks,
> Tamara Steijger

-- 
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