To use JRI to call R functions from Java, follow these steps:
- Set up environment variables R_HOME to where R has been installed, and add the R bin directory to the environment variable PATH.
- Open a new terminal window (on OS X and Linux systems), or open a command prompt window on Windows. Make sure to change the values according to your environment. The following commands help to set up environment variables on OS X and Linux systems. Make sure to change your directory location:
export R_HOME=/Library/Frameworks/R.framework/Resources
export PATH=$PATH:/Library/Frameworks/R.framework/Resources/bin/
- Execute the Java command as follows from the javasamples directory. Make sure to change the values according to your environment. ...