Test output with socket server.
00081 {
00082 Rconnection c2 = null;
00083 try {
00084 c2 = new Rconnection("localhost", 6311);
00085
00086
00087 c2.voidEval("cat(sink.number()); ");
00088 c2.voidEval("sink(type=\"output\"); ");
00089 c2.voidEval("sink(type=\"message\"); ");
00090 c2.voidEval("out <- socketConnection(host=\"localhost\", 1235);");
00091 c2.voidEval("sink(out, type=c(\"output\", \"message\"), split=TRUE);");
00092
00093
00094 double[] values;
00095 values = new double[] { 11, 12, 13 };
00096 c2.assign("x", values);
00097 String text = "Erfahrung ist das, was man bekommt, wenn man nicht das bekommt, was man wollte";
00098 c2.assign("y", text);
00099
00100
00101 c2.voidEval("print(\"-- normal --\");");
00102 c2.voidEval("x; ");
00103 c2.voidEval("y; ");
00104
00105 c2.voidEval("print(\"-- Output with print() --\");");
00106 c2.voidEval("print(x)");
00107 c2.voidEval("print(y)");
00108
00109 c2.voidEval("print(\"-- change options --\");");
00110 c2.voidEval("options(echo=TRUE); ");
00111 c2.voidEval("options(verbose=TRUE); ");
00112 c2.voidEval("options(warn=1); ");
00113 c2.voidEval("x; ");
00114
00115 c2.voidEval("print(\"-- Output with braced expression ? --\");");
00116 c2.voidEval("(x); ");
00117
00118 c2.voidEval("print(\"-- Output with embedded print() --\");");
00119 c2.voidEval("test <- c(22,23,24); print(test); test <- NULL; print(test); ");
00120
00121
00122
00123
00124
00125
00126
00127 } catch (Exception e) {
00128 e.printStackTrace();
00129 fail();
00130 } finally {
00131 c2.close();
00132 }
00133 }