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

From: Prof Brian Ripley <>
Date: Thu, 21 Jun 2007 09:21:14 +0100 (BST)

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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Thu 21 Jun 2007 - 08:27:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jun 2007 - 20:37:12 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.