R from within Java -


What is the best way to call R functionality from Java?

I am exploring a quick, easy and reliable way to create standard 2D scatter plots and histogram using my Java applications. I was thinking that it would be most convenient to use the packages / interfaces in the quick Google search.

I look forward to your suggestions!

Use JRI :. It comes bundled with RJVA, which includes some examples of usage.

A very simple example would be:

import java.io. *; Import java.awt.Frame; Import java.util.Enumeration; Import org.rosuda.JRI.Rengine; Import org.rosuda.JRI.REXP; Import org.rosuda.JRI.RVector; Import org.rosuda.JRI.RMainLoopCallbacks; Public class rJavaTest {public static zero main (string [] args) {roengin ray = new regin (args, false, new text console ()); REXP x; Re.eval ("print (1: 10/3)"); Println (x = re.eval ("iris")); RV Actor V = X.Asactor (); If (v.getNames ()! = Null) {System.out.println ("names are:"); (Mathematics E = V.Getnam (). Element (); e.hasMoreElements ();) {System.out.println (e.nextElement ()); }} If (true) {System.out.println ("Now the console is yours ... it's funny"); Re.startMainLoop (); } Else {re.end (); Println ("end"); }}}

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -