From kanglin at gmail.com  Tue May  3 06:00:04 2005
From: kanglin at gmail.com (D0c)
Date: Tue May  3 06:00:16 2005
Subject: [Rd] Re: Calling R functions from Java
In-Reply-To: <542BC889-60CF-44F7-8E25-92A88E6A4A0D@r-project.org>
References: <2667b213050429062157c4c124@mail.gmail.com>
	<2667b21305050123557078b47c@mail.gmail.com>
	<542BC889-60CF-44F7-8E25-92A88E6A4A0D@r-project.org>
Message-ID: <2667b2130505022100465b12f3@mail.gmail.com>

Thanks Simon, say i was to use  JRI / SJava instead, could you give
some examples of how i would implement showing a plot() in java on a
windows machine?

On 5/2/05, Simon Urbanek <simon.urbanek@r-project.org> wrote:
> On May 2, 2005, at 2:55 AM, D0c wrote:
> 
> > Hey guys thanks for the help. I found Rserve to be a solution i can
> > work with. i'll just use the JRClient to connect to Rserve. However
> > i have another problem. How can i get a nice graph from Rserve
> > using JRCLient using the plot() function?
> 
> There are several ways - you can use one of the R devices (e.g. jpeg/
> png, pdf or GDD) to create a file and then transport it to the client
> using Rconnection.openFile (or use it locally depending on your
> setup) or you can use one of the special devices to plot directly -
> xGD or JavaGD.
> 
> > Or for that matter a simple summary() of a dataset to be printed on
> > screen (eg JOptionPane)?
> 
> Something like
> String s = c.eval("paste(capture.output(summary
> (data)),collapse='\n')").asString();
> then add the string to whatever widget you want ... Maybe a better
> place for discussing Rserve is http://www.rosuda.org/lists.shtml
> 
> If you don't need the client/server separation you may consider JRI
> (as used by JGR) or SJava (from Omegahat) instead - both embed R into
> Java directly i.e. you have only one process running. JRI works
> nicely with rJava and JavaGD so you have a native Java graphics
> device that you can embed in your AWT/Swing windows. Rserve is better
> for applications with several clients such as web servers. SJava is
> more general, but is not easy to setup on non-unix platforms (your
> mileage may vary).
> 
> Cheers,
> Simon
> 
>


[Rd] Re: Calling R functions from Java
D0c