[R] question: DLL or EXE from R procedures

Prof Brian Ripley
Wed, 24 Dec 2003 13:42:30 -0000

On Tue, 23 Dec 2003, PaTa PaTaS wrote:

> I wonder if it is possible to create an DLL or EXE file performing R
> procedures. Instead of running R, reading data and calling some
> procedures, I would like to use R functions in the following way:
> "C:\linearRegression.exe data.txt" which would produce let's
say file
> "output.txt" with the results. Is there some way how to do it?

Yes (quite a few actually).  By far the simplest would be to write a small
C program making use of the system command to call R on a given script,
using either environment variables or the command-line of R to pass
arguments such as `data.txt'.  You could also call R via one of the D(COM)
interfaces although that would seem overkill for something so simple, and
I would use a scripting language (e.g. Perl) for this sort of thing.

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