StatET in Eclipse and R

CodeGuy picture CodeGuy · Feb 29, 2012 · Viewed 9.1k times · Source

I've managed to install StatET into eclipse, and I have a Java project called "Test" with some code in there. I'd like to be able to keep a .R file in that project folder and run it as a stand alone R script, seperate from the Java program. How can I do this? If I try to highlight some R code in a .R file and run it, it says "No session of R is active in the current workbench window."

Update: I added a run configuration and I now have the following error in a pop up box when I try to run the R script:

Launching the R Console was cancelled, because it seems starting the R engine failed. 
Please make sure that R package 'rj' (1.0.0 or compatible) is installed and that the R library paths are set correctly for the R environment configuration 'R'

Answer

jthetzel picture jthetzel · Feb 29, 2012

You need to first start an R console from within Eclipse. Select Run -> Run Configurations... from the menu bar. If you have not already created an R configuration, you can create a new one by right-clicking on R Console. For more information, Longhow Lam put together a nice guide (PDF).

EDIT: Regarding your new error message, make sure rj is installed in R by running one of these commands in the command-line version of R. For the current StatET 2.0:

install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.0")

For the development StatET 3.0:

install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1")

For the old StatET 0.10:

install.packages("rj", repos="http://download.walware.de/rj-0.5")

EDIT2

Its now

install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-2.1")

Also see http://www.walware.de/it/downloads/rj.02.01.html