[R] DCom / StatConnector / Windows-Cygnus-Gcc ?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 5 18:12:02 CEST 2000
On Thu, 5 Oct 2000, Oliver Lange wrote:
> Hello List !
>
> I want to use R as statistical & Graphical Tool for biological
> simulation programs. So, I want to combine my programs (written
> under cygnus-gcc on NT4.0) with R 1.0.1.1 under Windows.
>
> The data, produced by my program will be sent to R. There it should
> be statistically "transformed" and graphically displayed. The
> simulation program may wait until R has calculated and displayed
> the data. (Well, if both may work independently, "online" display of
> the data this would be nice as well, but there is no need to.)
>
> Following possibilities came to my attention by the email-Archives (&
> thanks to Yves Gauvreau)
> 1) embedding the C-Program into R ( .C - Call)
> 2) using the DCom/StatConnector
> 3) use the R-Source code and compile it into my program
>
>
> About 1): I want to keep the simulation program seperated from the
> (graphical) output. So, anybody who wants to check (or use) the
> proghram without graphic can do so easily. So, it would be easier,
> not to change the program into this concept. I would appreciate an
> other solution.
>
> About 2) I have problems in finding documentation about
> DCom/StatConnector.
> 2a: Where can I get a Docu about it ? (Like interface specifications
> ?)
In the sources on CRAN.
> 2b Has anybody a (simple) example, how he used it ? Best from
> within a C/C++ Program ?
It comes with a Visual Basic example. Writing any DCOM code in
Cygwin-Gcc is pretty tedious.
> 2c It is possible, to link Windows-DLLs to a Cygwin-Gcc program,
> thus making it (possibly ?) DCom aware. Has anybody done this
> before ?
>
> 3) Compiling the source code will be tedious :) I fear. Especially I
> will loose all possibilities to use the different packages in future
> programms. Has anybody tried this ?
You will need far, far more than the compiled source code, as R needs lots
of pacakge code just to start up. Take a look at the examples in the R
sources directory src/gnuwin32/front-ends. They show you how you link the
R.dll to your program and submit simple commands to R. Basically, like
using DCom/StatConnector without the DCOM overhead.
> I tend to the opinion, that 1) would be the easiest (but not to the
> general solucion for my problems) and 2) the nicest possibility, but
> not too easy. But, I'd like to know more about this.
The simplest solution of all seems to be to use files to communicate.
Write your simulation output to a file, and invoke an R script (via a
system call) to read that file. A further step is to pipe the input to
the R process: your C program can then write to the pipe and R will
process the script as you send it (and you will need to be careful to
flush the output when a command is ready to be executed). That way all
you need is a working R installation. Normally pipes are suspect from
Windows applications, but not from Cygwin I think.
I am assuming that you don't need any output from R back in your C
program. If you do, then DCOM is perhaps the easiest route.
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list