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

The .jinit() function initializes the Java Virtual Machine (JVM) and needs to be executed before invoking any of the rJava functions. If you encounter errors at this point, the issue is usually a lack of sufficient memory. Close unwanted processes or programs, including R, and retry.

For rJava to work, we need to sync up the Java version in the system environment with the rJava version. We used the .jcall("java/lang/System", "S", "getProperty", "java.runtime.version") command to get the Java version within the R environment.

After making sure that the Java versions are identical, the first thing we need to do, to access any Java object, is to set up classpath. We do this using .jaddClassPath. We pass the R working directory ...

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