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

There's more...

It is possible to create graphs using R from a Java program. Let's look at SimplePlot.java:

  • In the main method, first we create an Rengine instance and check whether the R session is created successfully.
  • We set the working directory in R, either from the last argument that was passed while executing the command, or from the current user directory from where the Java command was executed. The args.length == 0 array indicates that no argument is passed during the execution of the code, and hence, we use the user directory as the R working directory.
  • We use the read.csv function to read the file in R and load it into an R variable, auto.
  • We use the nrow function to get the number of rows in auto, and print the value.
  • We set  ...

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