Hallo!
Ich suche nach einer Möglichkeit, eine Funktion oder data.frames usw. aus R in Java zu plotten...
Ich habe das rJava Paket soweit eingebunden. Das funktioniert wunderbar. JRI - Java/R Interface for R
Aber, wenn ich in java, die plot() Funktion aufrufe, öffnet sich zwqar das R-Graphics-Fenster[R Graphicsevice 2(ACTIVE)]) aber es hat keinen Inhalt, noch reagiert es auf irgendwas...
wenn man es anklickt, erscheint folgende Meldung:
Java(TM) Platform SE binary reagiert nicht
....
Wie gesagt, ich verwende die JRI aus dem Paket rJava.....und habe die library unter properties/library korrekt bei deisem Projekt eingebunden....
Mein Code in Java:
Code:
import org.rosuda.JRI.Rengine;
/**
* @author Nero
*In this file, i will try to plot a simple example, only to test how it´s possible to plot through java
*Attention: Nothing will work if you have not included the JRI.jar as library ( through properties)
*
*/
public class TryPlot {
public static void main(String[] args) {
// TODO Auto-generated method stub
//start the Rengine (JRI)
Rengine re = new Rengine(null, false, null);
//in R: >a<- c(1.2,2.3,4.5) :
double da[] = {1.2, 2.3, 4.5};
long xp3 = re.rniPutDoubleArray(da);
re.rniAssign("a", xp3, 0);
//look up for a:
REXP x;
x = re.eval("a");
System.out.println(x);
//THE PROBLEM: The window opens, but nothing happens???
re.eval(" plot(a)");
}}
Ich hoffe, dass mir jemand einen Tipp geben kann, wie ich den Plot realisieren kann =)
Dankeschön!
lg
Nero
Lesezeichen