Examples of REXP


Examples of org.rosuda.JRI.REXP

        }
      }

      // Do peak picking.
      final REXP centWave = roi <= 1
          ? null
          : rEngine
              .eval("findPeaks.centWave(xRaw, ppm=0, mzdiff=0, verbose=TRUE"
                  + ", peakwidth=c("
                  + peakWidth.getMin()
                  * SECONDS_PER_MINUTE
                  + ", "
                  + peakWidth.getMax()
                  * SECONDS_PER_MINUTE
                  + ')'
                  + ", snthresh="
                  + snrThreshold
                  + ", integrate="
                  + integrationMethod.getIndex()
                  + ", ROI.list=ROIs)");
      peaks = centWave == null ? null : centWave.asMatrix();
    }
    return peaks;
  }
View Full Code Here

Examples of org.rosuda.REngine.REXP

        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;
      }

      if (false) {
        if (null != result)
          System.out.println("result class = " + result.getClass().getName());
        else
          System.out.println("result = null");
      }

      if (null == result) {
View Full Code Here

Examples of org.rosuda.REngine.REXP

    return false;
  }

  private static boolean isError(REXP result, SimpleEvaluationObject obj) {
    try {
      REXP value = result.asList().at(0);
      if (value.inherits("try-error")) {
        String prefix = "Error in try({ : ";
        String rs = value.asString();
        if (rs.substring(0, prefix.length()).equals(prefix)) {
          rs = rs.substring(prefix.length());
        }
        obj.error(rs);
        return true;
View Full Code Here

Examples of org.rosuda.REngine.REXP

      {
        Logs.log("Couldn't evaluate R command because either couldn't start server or connect to server!", 0, "R");
        return null;
      }
    }
    REXP ret = null;
    try
    {
      if(!safe && asString)
      {
        ret = rConnection.eval("paste(capture.output(print(" + command + ")),collapse='\\n')");
        Logs.log(ret.asString(), R.class);
      }
      else if(!safe)
      {
        ret = rConnection.parseAndEval("try(" + command + ",silent=TRUE)");
        if(ret.inherits("try-error"))
        {
          Logs.log(ret.asString(), Logs.ERROR, R.class);
        }
        else
        {}
      }
      else //safe
View Full Code Here

Examples of org.rosuda.REngine.REXP

    return false;
  }
 
  public REXP get(String name)
  {
    REXP ret = null;
    try
    {
      R.rConnection.get(name, ret, true);
    }
    catch (REngineException e)
View Full Code Here

Examples of org.rosuda.REngine.REXP

      return;
   
    try
    {
      rConnection.assign(".tmp.", WeaveConfig.getConnectionConfigFilePath());
      REXP result = rConnection.eval("length(readLines(.tmp.))");
      rConnection.assign(".tmp.", new REXPNull());
      rConnection.close(); // must close before throwing exception
      if (result.isNumeric())
        throw new RemoteException("R script access is not allowed because it is unsafe (The user running Rserve has file read/write access).");
      throw new RemoteException("Unexpected result in requestScriptAccess(): " + result);
    }
    catch (RserveException e)
    {
View Full Code Here

Examples of org.rosuda.REngine.REXP

  }
 
  private static REXP evalScript(RConnection rConnection, String script, boolean showWarnings) throws REXPMismatchException,RserveException
  {
    int warn = showWarnings ? 2 : 1;
    REXP evalValue = rConnection.eval("try({ options(warn=" + warn + ") \n" + script + "},silent=TRUE)");
    return evalValue;
  }
View Full Code Here

Examples of org.rosuda.REngine.REXP

        for (int i = 0; i < Rdatas.length; i++)
        {
          String scriptToAcessRObj = Rdatas[i];
          if (scriptToAcessRObj.compareTo("mycache") == 0)
            continue;
          REXP RobjValue = evalScript(rConnection, scriptToAcessRObj, false);
          //When function reference is called returns null
          if (RobjValue == null)
            continue;
          resultVector.add(new RResult(scriptToAcessRObj, rexp2javaObj(RobjValue)))
        }
View Full Code Here

Examples of org.rosuda.REngine.REXP

        String plotEvalValue = plotEvalScript(rConnection,docrootPath, plotScript, showWarnings);
        resultVector.add(new RResult("Plot Results", plotEvalValue));
      }
      for (int i = 0; i < outputNames.length; i++){// R Script to EVALUATE output Script
        String name = outputNames[i];           
        REXP evalValue = evalScript(rConnection, name, showWarnings)
        resultVector.add(new RResult(name, rexp2javaObj(evalValue)));         
      }
      // clear R objects
      evalScript(rConnection, "rm(list=ls())", false);
     
View Full Code Here

Examples of org.rosuda.REngine.REXP

        RList rList = rexp.asList();
        Object[] listOfREXP = rList.toArray();
        //convert object in List as Java Objects
        // eg: REXPDouble as Double or Doubles
        for(int i = 0; i < listOfREXP.length; i++){
          REXP obj = (REXP)listOfREXP[i];
          Object javaObj =  rexp2javaObj(obj);
          if (javaObj instanceof RFactor)
          {
            RFactor factorjavaObj = (RFactor)javaObj;
            String[] levels = factorjavaObj.asStrings();
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.