O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To use JRI to call R functions from Java, follow these steps:

  1. Set up environment variables R_HOME to where R has been installed, and add the R bin directory to the environment variable PATH.
  2. 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/ 
  1. Execute the Java command as follows from the javasamples directory. Make sure to change the values according to your environment. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required