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