• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Java (Eclipse) and R - JRI/rJava

Does anyone have any experience running R from Java in eclipse?

I'm running Indigo and R v2.9.0 - I have limited options here, unfortunately.

I was able to get JRI/rJava up and running and R and Java communicating with one another with a slight hack by replacing R.dll in both bin and rjava/JRI with v.2.11.0.

The one problem that I'm running into is that the R libraries are not working properly.

I can pass through vectors or expressions without issue and can perform basic operations - anything in the base package anyhow. If I try to use any of the built in statistical functions (cor, for instance) I get an expression not found error.

I've tried setting forcing library(stats), but I get an error that the package does not contain the proper structure. I've also tried setting R_LIBS and R_LIBS_USER explicitly in the run configuration, it doesnt seem to make any difference.

When I call .libpaths it returns the same F:/R2.9.0/R/Library though there is no F:\ on my computer - I suspect that JRI is renaming my C:\ path to F:\ (?)

If I run R directly (with the old v2.9.0 R.dll) the stats functions run just fine.

Any thoughts on this? Its driving me nuts ;)

Will need to run a few hundred (thousand?) iteration variations. Any idea what the speed is like? Would I be better off writing a batch file to pass csv's between the two?

There seems to be limited documentation about this and it is, or course, rather difficult to find relevant information on 'r' or 'rJava' search terms on the interwebs.
 

alain

Older and Wiser
I run it all the time. I don't use rJava but Rterm. What exactly do you want to do? are you using StatET?
 
I run it all the time. I don't use rJava but Rterm. What exactly do you want to do? are you using StatET?

I will need to run regressions (canned poisson, negative binomial, VARS etc) which will lead me to another problem. The zoo package doesn't seem compatible with 2.9.

I've been trying to configure StatET as well - I ran into errors running the console. R isn't officially 'supported' at work.

I can access the exe and gui of 2.11 and 2.12 on a read-only network drive but can only download 2.9 locally - iirc linking StatET to the network path versions didn't work work at all. It did recognize the local 2.9 install but RJ wasn't installed correctly. Complicating things, my Program Files is read only. I tried forcing StatET to read in a user library in a different directory and tried intalling RJ directly into the R.exe console to a different (r/w) library path but couldn't get that to work either :(

At the end of the day I tried copying R to 'my documents' which (kindof) worked for JRI/rJava. I haven't had a chance to try linking StatET that way.

Any thoughts, words of wisdom??
 

alain

Older and Wiser
You need to get the zoo version that is compatible with 2.9. zoo has been around for a while. We used zoo with R 2.6 and 2.7 so that is not a problem.

If what you are trying to use is R and Java, you are set for a great deal of pain. It works but it's not that simple. You will need to find the right JAR that is compatible with R2.9 as well.

BTW, it's not clear to me what you want to do and how you are planning on doing it.
 
Top