[R] Java/C interface with R

Li Dongfeng mavip5 at inet.polyu.edu.hk
Fri Sep 17 11:43:50 CEST 1999



Prof Brian D Ripley wrote:
> 
> On Fri, 17 Sep 1999, Li Dongfeng wrote:
> 
> >
> >
> > Prof Brian D Ripley wrote:
> > >
> > > > On Thu, 16 Sep 1999, Lionel Siau wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm rarther curious if it is possible to interface C or Java GUIs with
> > > > > the underlying R statistical engine. SPLUS has something like this in
> > > > > S+SDK.
> 
> [...]
> 
> > > I think the future of this has to be inter-process communications,
> > > like CORBA or (shudder) (D)COM.  There is some example code for the latter
> > > on Windows, which should appear in the next release: we can let you
> > > see a version shortly if you really want to get on with it. (It works well,
> > > but it does not handle errors well yet).  And an R/CORBA interface
> > > is also under construction, I understand.
> >
> > That's really exciting! I am creating (another) R web interface,
> > this time using an long-running R subprocess(the other existing
> > R web servers start one R process per request). But the subprocess
> > will end if the submited source has any error. An R/CORBA interface
> > with good error handling will be great for web integration.
> 
> Well,
> 
> (i) It is R that will need the good error handling, and better error
> handling is planned but is not imminent.
> 
> (ii) Running multiple external requests to a single R process needs a lot
> of thought. What happens when two users try to do similar things? Suppose

There is a locking mechanism. If two request come, the later one use
a new short-run R sub-process.

> two people want to send slightly different versions of the same data set to
> R and get plots back? How are you going to ensure that they don't
I am now using a naive solution: for every request, prepend
  rm(list=ls())
to the program. Since there is a lock, two request will
not get there code mixed together.
If the sub-process stopped due to program
error, a new request will automatically re-start the 
long-running R sub-process.

> interfere?  What is to stop one user overriding some system functions with
> copies in the workspace that will persist for all subsequent users?
This is a problem to be solved. In fact, there is no
good way to prevent users to use the system() function
to do some nasty things(maybe I can scan the code
and reject those containing system(...) calll, 
but this is not an elegant solution).
Now I use a long-running R process for trusted
code(code installed at the server), use short-run
R process for user's codes.

> 
> I see this as a lot more complicated than the original question (a GUI for
> R) unless the capabilities of R are severely curtailed.
You are right. 

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