tags:

views:

224

answers:

3

Is rjava the only way to connect R to Java? I am asking because there is a disclaimer at the end of the web page:

This interface uses Java reflection API to find the correct method so it is much slower and may not be right (works for simple examples but may not for more complex ones). For now its use is discouraged in programs as it may change in the future.

This is slightly concerning. How do you address this issue? I know that Rweka has a self-contained interface, so I may look into that package, but maybe many R users have already gone through the pains.

+5  A: 

I think that disclaimer only applies if you use the $ operator to access your java objects. As long as you stick with the .jcall function you won't incur the overhead.

In terms of experience using rJava, I've found it works exactly as advertised and for my package (farmR) it hasn't caused any performance problems. I don't make a huge number of calls into java though, and I haven't used any of the java GUI toolkits.

Ira Cooke
+4  A: 

It is not the only one as the Omegahat project also has the RSJava package. But as many of the other brilliant innovations from Omegahat (which practically speaking is really just Duncan Temple Lang), this one may not build as easily or reliably.

The rJava package on the other hand is used by almost thirty other packages

CADStat, Containers, Deducer, JGR, RFreak, RImageJ, RJDBC, RLadyBug, aCGH.Spline, ant, arulesNBMiner, colbycol, cshapes, dynGraph, farmR, gWidgetsrJava, glmulti, helloJavaWorld, iplots, rSymPy, rcdk, rcdklibs, scagnostics, spcosa, RKEA, RWeka, Snowball, openNLP, wordnet

which I take as quite the endorsement.

Dirk Eddelbuettel
Maybe OT (quite certain) but, I really recommend both new and experienced R users to take a look at the Omegahat project website. The entire R community has to thank Duncan Temple Lang for this invaluable resource (XML, RCurl packages are my favorites).
Paolo
A: 

I am an Rweka user, and I can tell you it is amazingly quick, it outperforms weka alone, while using it's functions in the r environment. I think that the R package has a very special way to integrate inside the language java libraries, nevertheless these libraries need to be prepared to allow this. For being able to do a proper integration you will need to do an important amount of research in order to see how to make things fit properly. I recommend you to read the documentation that comes with R, which details which are the best practices for writing NEW LIBRARIES libraries.

mariana soffer