[R] calling R from java

Xiao, Nick [RA] NIANQING.XIAO at saic.com
Wed Apr 21 20:30:36 CEST 2004


Hi, 

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

2. When you quit R: o.write("quit(\"yes\")\n") instead of
o.write("quit(\"no\")\n") to save everything to the .Rdata

HTH, 

Nick

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of
anthony.ferrari at ensimag.imag.fr
Sent: Wednesday, April 21, 2004 12:08 PM
To: r-help at stat.math.ethz.ch
Subject: [R] calling R from java



Hello,

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())
o.wrote("...")
... 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).
So,
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 ? )


many thanks for helping me

best regards,
af
anthony.ferrari at ensimag.imag.fr

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list