@Test public void testCreateNewLocalRSession() { Rsession rsession = RUtils.createNewLocalRSession(); if (RUtils.isRAvailable()) { assertNotNull(rsession); } else { throw new RuntimeException("cannot be tested without R being available in the environment"); } System.err.println("status: "+rsession.getStatus()); REXP o = rsession.eval("R.version.string"); assertNotNull(o); try { System.err.println("using R version "+o.asString()); } catch (REXPMismatchException e1) { fail("unable to get R version:"+e1.getMessage()); } { REXP expRes = rsession.eval("1"); try { assertEquals(1, expRes.asInteger()); } catch (REXPMismatchException e) { e.printStackTrace(); fail(e.getMessage()); } } { REXP expRes = rsession.eval("-1"); try { assertEquals(-1, expRes.asInteger()); } catch (REXPMismatchException e) { e.printStackTrace(); fail(e.getMessage()); } } { REXP expRes = rsession.eval("2+2"); try { assertEquals(4, expRes.asInteger()); } catch (REXPMismatchException e) { e.printStackTrace(); fail(e.getMessage()); } } }
public static Rsession createNewLocalRSession() { return Rsession.newInstanceTry( System.out, null ); }
RUtils { public static Rsession createNewLocalRSession() { return Rsession.newInstanceTry( System.out, null ); } }
RUtils { public static Rsession createNewLocalRSession() { return Rsession.newInstanceTry( System.out, null ); }  }
RUtils { public static Rsession createNewLocalRSession() { return Rsession.newInstanceTry( System.out, null ); }  static boolean isRAvailable(); static String getRVersion(); static boolean isRAvailable(boolean force); static Rsession createNewLocalRSession(); static void loadPackage(Rsession session, String name); static boolean isPackageInstalled(Rsession session, String name); static boolean isPackageLoaded(Rsession session, String name); static void installPackage(Rsession session, String name); static String analyzeLastError(Rsession r); static void checkStatus(Rsession r); static boolean isResponsive(Rsession r); static Integer evalAsInteger(Rsession session, String cmd); static Boolean evalAsBoolean(Rsession session, String cmd); static String evalAsString(Rsession session, String cmd); static Double evalAsDouble(Rsession session, String cmd); }
RUtils { public static Rsession createNewLocalRSession() { return Rsession.newInstanceTry( System.out, null ); }  static boolean isRAvailable(); static String getRVersion(); static boolean isRAvailable(boolean force); static Rsession createNewLocalRSession(); static void loadPackage(Rsession session, String name); static boolean isPackageInstalled(Rsession session, String name); static boolean isPackageLoaded(Rsession session, String name); static void installPackage(Rsession session, String name); static String analyzeLastError(Rsession r); static void checkStatus(Rsession r); static boolean isResponsive(Rsession r); static Integer evalAsInteger(Rsession session, String cmd); static Boolean evalAsBoolean(Rsession session, String cmd); static String evalAsString(Rsession session, String cmd); static Double evalAsDouble(Rsession session, String cmd);  }