Nirali Nirali - 1 month ago 16
R Question

Rserve installation Error

I want to run an R script into eclipse.


  • R 3.1.1

  • Ubuntu 12.04

  • Eclipse Kepler

  • Jars:


    • JRI.jar

    • REngine.jar

    • RserveEngine.jar


  • Environment (Run -> Run Configuration -> Environment)


    • R_HOME : /usr/local/lib/R




Code:

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPMismatchException;
import org.rosuda.REngine.Rserve.RConnection;
import org.rosuda.REngine.Rserve.RserveException;
import org.rosuda.JRI.Rengine;

public class HelloWorldApp {

public static void main(String[] args) throws RserveException, REXPMismatchException, FileNotFoundException, IOException {
RConnection c = new RConnection("localhost",6311);
if(c.isConnected()) {
System.out.println("Connected to RServe.");
if(c.needLogin()) {
System.out.println("Providing Login");
c.login("username", "password");
}

REXP x = c.eval("1:10");
for(int i=0;i < x.length();i++)
{
System.out.println(x.asIntegers()[i]);
}
System.out.println("Reading script...");
Rengine r = new Rengine(args, true, null);

r.eval(" plot (x");

} else {
System.out.println("Rserve could not connect");
}

c.close();
System.out.println("Session Closed");
}

}


Output:

Connected to RServe.

1

2

3

4

5

6

7

8

9

10

Reading script...

Fatal error: you must specify '--save', '--no-save' or '--vanilla'


The same error occured in Rstudio :

library("Rserve")
Rserve()


Output:

Starting Rserve:
/usr/local/lib/R/bin/R CMD /home/mansi/R/x86_64-unknown-linux-gnu-library/3.1/Rserve/libs//Rserve
Fatal error: you must specify '--save', '--no-save' or '--vanilla'


So please help me to solved this fatal error.

Answer
Try: Rserve(args='--vanilla')

I had the same problem, and this worked for me.