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 Rserve to call R functions from Java, follow these steps:

  1. Start the Rserve server to accept client connections:
> Rserve(args="--no-save")  - On Mac and Linux 
> Rserve() - on windows 
Rserv started in daemon mode. 
  1. Execute the Java program to draw ggplot in R and display the image. Change the argument to the call to reflect your R working directory where the auto-mpg.csv file resides:
java -cp ..:../lib/* javasamples.SimpleGGPlot /Users/sv/book/Chapter11 

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