本文整理汇总了Java中org.rosuda.JRI.Rengine.waitForR方法的典型用法代码示例。如果您正苦于以下问题:Java Rengine.waitForR方法的具体用法?Java Rengine.waitForR怎么用?Java Rengine.waitForR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rosuda.JRI.Rengine
的用法示例。
在下文中一共展示了Rengine.waitForR方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println("Creating Rengine (with arguments)");
// If not started with --vanilla, funny things may happen in this R
// shell.
String[] Rargs = { "--vanilla" };
Rengine re = new Rengine(Rargs, false, null);
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
ImportingObjs.Start(re);
ExportingObjs.Start(re);
re.end();
}
示例2: InicializeRNet
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
private void InicializeRNet() {
System.out.println("Creating Rengine (with arguments)");
// If not started with --vanilla, funny things may happen in this R
// shell.
String[] Rargs = { "--vanilla" };
engine = new Rengine(Rargs, false, null);
// System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!engine.waitForR()) {
System.out.println("Cannot load R");
return;
}
String rfilepath = "C:\\\\Program Files\\\\R\\\\R-3.3.1\\\\library\\\\Functions.R";
engine.eval("source(\"" + rfilepath + "\")");
}
示例3: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
// just making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
System.out.println("Creating Rengine (with arguments)");
Rengine re=new Rengine(args, false, new TextConsole());
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
selectOneEnabled(re);
selectOneDisabled(re);
selectMostEnabledDisabled(re);
re.end();
System.out.println("end");
}
示例4: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
// just making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
System.out.println("Creating Rengine (with arguments)");
re= new Rengine(args, false, new TextConsole());
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
System.exit(1);
}
RAnalysis.readCSV(re,"jhipsterFeatures.csv","data");
System.out.println("File read");
//oneEnabled(re);
//oneDisabled(re);
mostEnabledDisabled(re);
re.end();
System.out.println("done");
}
示例5: init
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public void init() {
// Making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
String[] args = {"--vanilla"};
re = new Rengine(args, false, new TextConsole());
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
}
示例6: setUpR
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
@BeforeClass
public static void setUpR() {
// just making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
fail(String.format("Invalid versions. Rengine must have the same version of native library. Rengine version: %d. RNI library version: %d", Rengine.getVersion(), Rengine.rniGetVersion()));
}
// Enables debug traces
Rengine.DEBUG = 1;
System.out.println("Creating Rengine (with arguments)");
// 1) we pass the arguments from the command line
// 2) we won't use the main loop at first, we'll start it later
// (that's the "false" as second argument)
// 3) no callback class will be used
engine = new Rengine(new String[] { "--no-save" }, false, null);
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!engine.waitForR()) {
fail("Cannot load R");
}
}
示例7: callRJava
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public void callRJava() {
Rengine re = new Rengine(new String[] { "--vanilla" }, false, new rtest3());
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
//String path = re.jriChooseFile(0);
String cmd = "source('/home/starqiu/workspace/RDMP1/src/main/java/ustc/sse/r/tbmr.R',echo=TRUE)";
//String cmd = "source('/home/starqiu/workspace/RDMP1/src/main/java/ustc/sse/r/WordCount.R',echo=TRUE)";
String rv = re.eval(cmd).asString();
/*System.out.println(rv);
String cmd2="area(10)";
REXP res = re.eval(cmd2);
System.out.println(res.asDouble());
res = re.eval("a");
for (int b : res.asIntArray()) {
System.out.println(b);
}*/
re.end();
}
示例8: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println("Press <Enter> to continue (time to attach the debugger if necessary)");
try { System.in.read(); } catch(Exception e) {};
System.out.println("Creating Rengine (with arguments)");
Rengine re=new Rengine(args, true, new TextConsole2());
System.out.println("Rengine created, waiting for R");
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
System.out.println("re-routing stdout/err into R console");
System.setOut(new PrintStream(new RConsoleOutputStream(re, 0)));
System.setErr(new PrintStream(new RConsoleOutputStream(re, 1)));
System.out.println("Letting go; use main loop from now on");
}
示例9: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
args = new String[1];
args[0] = "--vanilla";
System.out.println("Press <Enter> to continue (time to attach the debugger if necessary)");
try { System.in.read(); } catch(Exception e) {};
System.out.println("Creating Rengine (with arguments)");
Rengine re=new Rengine(args, true, new TextConsole2());
System.out.println("Rengine created, waiting for R");
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
System.out.println("re-routing stdout/err into R console");
System.setOut(new PrintStream(new RConsoleOutputStream(re, 0)));
System.setErr(new PrintStream(new RConsoleOutputStream(re, 1)));
System.out.println("Letting go; use main loop from now on");
}
示例10: Rengine_Service
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public Rengine_Service(){
String args [] = new String[1];
args[0] = "--vanilla";
// System.out.println("Creating Rengine (with arguments)");
// 1) we pass the arguments from the command line
// 2) we won't use the main loop at first, we'll start it later
// (that's the "false" as second argument)
// 3) the callbacks are implemented by the TextConsole class above
re=new Rengine(args, false, new TextConsole());
// System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
}
}
示例11: createREngine
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
private void createREngine(){
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
System.out.println("Creating Rengine (with arguments)");
// 1) we pass the arguments from the command line
// 2) we won't use the main loop at first, we'll start it later
// (that's the "false" as second argument)
// 3) the callbacks are implemented by the TextConsole class above
String[] Rargs = {"--no-save"};
re=new Rengine(Rargs, false, new TextConsole());
engineState = EngineState.RUNNING;
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
engineState = EngineState.STOPPED;
return;
}
initREngine();
}
示例12: InicializeRNet
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
private void InicializeRNet()
{
System.out.println("Creating Rengine (with arguments)");
// If not started with --vanilla, funny things may happen in this R
// shell.
String[] Rargs = { "--vanilla" };
engine = new Rengine(Rargs, false, null);
// System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!engine.waitForR()) {
System.out.println("Cannot load R");
return;
}
String rfilepath = "C:\\\\Program Files\\\\R\\\\R-2.15.1\\\\library\\\\Functions.R";
engine.eval("source(\"" + rfilepath + "\")");
}
示例13: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println(System.getenv("R_HOME"));
System.out.println(System.getProperty("java.library.path"));
args = new String[1];
args[0] = "--vanilla";
// System.out.println("Creating Rengine (with arguments)");
// 1) we pass the arguments from the command line
// 2) we won't use the main loop at first, we'll start it later
// (that's the "false" as second argument)
// 3) the callbacks are implemented by the TextConsole class above
Rengine re=new Rengine(args, false, new TextConsole());
// System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
try {
REXP x;
System.out.println(x=re.eval("library('maximumentropy')"));
System.out.println(re.eval("model <- maximumentropy(Species ~., data=iris,addslack=T)"));
System.out.println(re.eval("save(model,file='mode.RData')"));
System.out.println(x=re.eval("predict(model,subset(iris,select=-Species))"));
} catch (Exception e) {
System.out.println("EX:"+e);
e.printStackTrace();
}
}
示例14: main
import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void main(String[] args) {
// just making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
System.out.println("Creating Rengine (with arguments)");
// 1) we pass the arguments from the command line
// 2) we won't use the main loop at first, we'll start it later
// (that's the "false" as second argument)
// 3) the callbacks are implemented by the TextConsole class above
Rengine re=new Rengine(args, false, new TextConsole());
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
createCircleTypeApp(re);
createCircleBuildResult(re);
createBoxplotTimeBuildWithoutDockerApp(re);
createBoxplotTimeBuildWithDockerApp(re);
createBoxplotTimeBuildWithoutDockerBuildTool(re);
createBoxplotTimeBuildWithDockerBuildTool(re);
createBoxplotTimeCompile(re);
createBoxplotTimeGeneration(re);
createBoxplotCoverage(re);
createBoxplotImageDockerApplications(re);
createBoxplotImageDockerDB(re);
createBalloonPlot(re);
createBalloonPlotBugsFeatures(re);
createPieChartBuildResultByBuildTool(re);
createBoxplotCucumeberDatabase(re);
re.end();
System.out.println("end");
}