[R] R - API ?
guido at hal.stat.unipd.it
Fri Jan 29 21:11:57 CET 1999
On Fri, Jan 29, 1999 at 02:12:45PM +0000, Reinhard Sy wrote:
> I would like to use R in my own main-Program. Is this possible ? If yes
> where I can find an documentation about this feature ?
> All my question belongs to R running under Windows.
It is possible but all the alternatives that come to my mind require
some work since 'as shipped' R is not designed as an 'embedable'
Basically, you need to:
1) initialize appropriately the interpreter (you have to 'stole'
code from the Windows specific sources (in particular from
src/gnuwin32/system.c and src/gnuwin32/front-end/Rterm.c in
rw0632s.zip) and from the main distribution (in particular
you need, I suppose, all the code of function mainloop in
src/main/main.c excluding the end which enter in the
read-and-eval loop). Your program can then 'talk'
with the interpreter via the parse/eval function. Example
is the read-eval-loop in src/main/main.c.
2) link your program against R.dll (how depend from the compiler).
I am not sure that there is any documentation but the source.
Perhaps, some other can be more helpful than me.
Remark1: Thomas Lumley has some 'sockets' library for R which
should let something of this sort. However, I have not
looked to it and I don't know if it is portable to Windows.
Remark2: I don't rebember who (I apologize 'a priori' for
this) have prepared a R-perl interface which I think can be
taken as a model. It is included in the GNU/Debian Linux
distribution so you can find it at http://www.debian.org.
Again, I don't know if it can be easily ported to Windows.
> If I cannot call an R-API Function from my C-Program is it possible to
> run R in batch-mode like Splus ?
That is easy. Starting from version 0.63.1, there are two executable
under Windows (at least in the rwxxxx port). One Rgui.exe is for
interactive use, the other Rterm.exe is for batch-mode operation; basically
Rterm < input.file. R > output.file
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help