我是java
and的初学者renjin
。我需要我的输出结果显示在我的jtextpane
,我该怎么做?我好累。如果你知道怎么做,请告诉我。谢谢
RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
// create a Renjin engine:
ScriptEngine engine = factory.getScriptEngine();
try {
//engine.eval("RealData <- read.csv('E:/R Project/Original Data Cleaning Data Historis.csv', header = TRUE)");
engine.eval("RealData <- read.csv('"+textPath.getText().replace('\\','/')+"', header = TRUE)");
//engine.eval("print(RealData)");
engine.eval("library(e1071)");
//engine.eval("tune.out <- tune(svm, hasil~., data=RealData, kernel=\"radial\",ranges = list(cost = c(1:10),gamma = c (1:4)))");
//engine.eval("summary(tune.out)");
engine.eval("svmfit <- svm(hasil~., data=RealData, kernel=\"radial\", cost=2, gamma=4)");
editorSvm.setText(engine.eval("print(svmfit)").toString());
} catch (ScriptException ex) {
Logger.getLogger(Klasifikasi.class.getName()).log(Level.SEVERE, null, ex);
}`