[Rd] Call R function from Java
simon.urbanek at r-project.org
Fri Jul 14 02:27:29 CEST 2006
[I'm moving this discussion to stat-rosuda-devel, because JRI is
strictly speaking a contributed package]
On Jul 13, 2006, at 5:28 PM, Adam Kapelner wrote:
> It worked. All I had to do is set PATH = < R directory > in my
> system variables in "My Computer" and that was it!
> Oh btw Simon, I couldn't find the run.bat in the JRI_0.2-4.tar.gz
> file. I found a "run.in" but that is a unix bash script.
run (and run.bat respectively) are created by make, so you should run
"sh configure.win; make" on Windows or "./configure; make" on unix.
The script must contain paths to your JRE and R, so it cannot be
shipped directly in JRI - that's why it is created during the build
> Another question:
> When I'm evaluating R expressions:
> I sometimes get back form the println:
> RXP[unknown/19, id=1208787616, o=null]
> Is there anyway to actually view that output as a string?
It is a generic vector (aka list). If you use JRI 0.3 (from http://
www.rosuda.org/R/nightly ), you can use
for (Enumeration e = v.elements() ; e.hasMoreElements() ;)
If you are using JRI 0.2 or earlier, you'll have to use something
long l = r.rniGetVector(rexp3.xp);
int i=0; while(i<l.length) System.out.println(new REXP(r, l[i++]));
More information about the R-devel