rscript
About rscript
|
DescriptionRscript is an implementation of Java 6 Scripting for R. (see also javax.script and JSR 223)This allows R code to be run from a Java program in a standard manner. For example: ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByExtension("R"); Object ret = engine.eval("print(1); 1"); ret = ((Invocable)engine).invokeFunction("print", 2); The engine supports the passing of boolean, integer, double and string objects and arrays too and fro between Java and R. It uses either Rserve or JRI to communicate with R. UsageCommonRequires JRS.jar on the classpath.The system property org.rosuda.jrs.host determines the default Rserve host to connect to or use JRI if not set. RserveAlso requires REngine.jar and RserveEngine.jarNote: Rserve must also be running on the localhost (R CMD Rserve). java -Dorg.rosuda.jrs.host=localhost -classpath JRS.jar:REngine.jar:RserveEngine.jar my.prog JRIAlso requires JRI.jar and JRIEngine.jar and the jri JNI file (libjri.so, jri.dll, ...) and the R_HOME environment variable set (see the JRI FAQ).java -Djava.library.path=jnidir -classpath JRS.jar:REngine.jar:JRI.jar:JRIEngine.jar my.prog LicenseGPLv2 or CommercialAuthorMartyn Tebby (martyntebby@yahoo.com) |