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 it works...

We execute the Java program, InvokeScript with three arguments. The first two arguments mention the columns of the auto table for which correlation is computed, and the optional third argument is the working directory, where the auto-mpg.csv file and the R script reside.

Let's look at the InvokeScript.java code:

  • In the main method, first we create an Rengine instance and check whether the R session is created successfully.
  • We check whether there are at least two arguments passed to the InvokeScript Java program. If not, we display an error message:
To execute, please provide 2 variable names from auto-mpg dataset. 
  • If the length of the arguments array, args.length, is equal to 2, we know that the user did not provide the ...

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