Package org.rosuda.REngine.Rserve

Examples of org.rosuda.REngine.Rserve.RConnection.eval()


                                                BEGIN_MAGIC, END_MAGIC);
    handler.start();

    RConnection rconn = new RConnection("127.0.0.1", port);
    rconn.login("beaker", password);
    int pid = rconn.eval("Sys.getpid()").asInteger();
    return new RServer(rconn, handler, errorGobbler, port, password, pid);
  }

  // set the port used for communication with the Core server
  public void setCorePort(int corePort)
View Full Code Here


      // direct graphical output
      String tryCode;
      if (init) {
        tryCode = code;
      } else {
        con.eval("do.call(svg,c(list('" + file + "'), beaker::saved_svg_options))");
        tryCode = "beaker_eval_=withVisible(try({" + code + "\n},silent=TRUE))";
      }
      REXP result = con.eval(tryCode);
      if (init) {
        obj.finished(result.asString());
View Full Code Here

        tryCode = code;
      } else {
        con.eval("do.call(svg,c(list('" + file + "'), beaker::saved_svg_options))");
        tryCode = "beaker_eval_=withVisible(try({" + code + "\n},silent=TRUE))";
      }
      REXP result = con.eval(tryCode);
      if (init) {
        obj.finished(result.asString());
        return obj;
      }
View Full Code Here

      } else {
        server.outputHandler.reset(obj);
        String finish = "print(\"" + BEGIN_MAGIC + "\")\n" +
          "print(beaker_eval_$value)\n" +
          "print(\"" + END_MAGIC + "\")\n";
        con.eval(finish);
      }
    } catch (RserveException e) {
      if (127 == e.getRequestReturnCode()) {
        obj.error("Interrupted");
      } else {
View Full Code Here

      }
    }

    // flush graphical output
    try {
      con.eval("dev.off()");
    } catch (RserveException e) {
      obj.error("from dev.off(): " + e.getMessage());
    }

    addSvgResults(file, obj);
View Full Code Here

      if (null == rServer) {
        rServer = startRserve();
      }
      RConnection rconn = new RConnection("127.0.0.1", rServer.port);
      rconn.login("beaker", rServer.password);
      int pid = rconn.eval("Sys.getpid()").asInteger();
      newRs = new RServer(rconn, rServer.outputHandler, rServer.errorGobbler,
                          rServer.port, rServer.password, pid);
    }
   
    this.shells.put(id, newRs);
View Full Code Here

      rConnection = getRConnection();
      rConnection.assign("data", getREXP(data));
     
      String script = "normalized <- t(as.matrix(sapply(data, function(x) {(x - min(x, na.rm=TRUE))/(max(x, na.rm=TRUE)- min(x, na.rm=TRUE))})))";
     
      rConnection.eval(script);
     
      REXP evalValue = rConnection.eval("normalized");
      result = evalValue.asDoubleMatrix();
    }
View Full Code Here

     
      String script = "normalized <- t(as.matrix(sapply(data, function(x) {(x - min(x, na.rm=TRUE))/(max(x, na.rm=TRUE)- min(x, na.rm=TRUE))})))";
     
      rConnection.eval(script);
     
      REXP evalValue = rConnection.eval("normalized");
      result = evalValue.asDoubleMatrix();
    }

    catch (Exception e)
    {
View Full Code Here

            "if(is(obj, \"try-error\")) { statistic <- 0 \n  pvalue <- 0} else { cdoutput <- obj\n" +
            "statistic <- cdoutput$statistic\n" +
            "pvalue <- cdoutput$p.value}";
      }
     
      rConnection.eval(script);
      result.pvalue = rConnection.eval("pvalue").asDouble();
      result.statistic = rConnection.eval("statistic").asDouble();
     
    }
   
View Full Code Here

            "statistic <- cdoutput$statistic\n" +
            "pvalue <- cdoutput$p.value}";
      }
     
      rConnection.eval(script);
      result.pvalue = rConnection.eval("pvalue").asDouble();
      result.statistic = rConnection.eval("statistic").asDouble();
     
    }
   
    catch (Exception e)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.