[R] calling R from java
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Apr 21 20:35:58 CEST 2004
A third way is to start R with --slave --save (in that order).
On Wed, 21 Apr 2004, Xiao, Nick [RA] wrote:
> There are two ways to do what you want to do:
> 1. Explicitly use save() in R. Something like: o.write("save(obj1, obj2,
> file=\"filename\")") to save a select set of R objects to a file you specify
> (can be retrieved with load later), or
Or use save.image to save all the objects.
> 2. When you quit R: o.write("quit(\"yes\")\n") instead of
> o.write("quit(\"no\")\n") to save everything to the .Rdata
> -----Original Message-----
> I need to call R from a java(swing) application. I manage to do it with
> something like :
> Process p = Runtime.getRuntime().exec("R --slave")
> OutputStreanWriter o = new OutputStreamWriter(p.getOutputStream())
> ... etc
> but at the end no .Rdata file has been created and there are some data I
> don't want to reload each time (for time execution reasons).
> Is it possible when calling R from java to create a .Rdata file to save
> data and as a consequence when recalling in the same directory not to have
> to reload those data ?
> (Maybe the option --slave need to be changed ? )
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
More information about the R-help