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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
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,                  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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
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 https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.