November 2016
Beginner to intermediate
959 pages
43h 46m
English
In earlier recipes, we executed R functions from within Java. In this recipe, we execute an R script from Java and read the results from R into Java for further processing.
Make sure all the steps in the first recipe, Using Java objects in R, in this chapter are completed. Also make sure the auto-mpg.csv and corr.R files are in your R working directory.
Execute the Java program from your command prompt to invoke an R script from a Java program. Be sure to change the last part to reflect your R working directory:
java -Djava.library.path=/Library/Frameworks/R.framework/Resources/library/rJava/jri/ -cp ..:../lib/* javasamples.InvokeRScript mpg weight /Users/sv/book/Chapter11
Read now
Unlock full access