@Test public void testLoadPackage() { Rsession session = RUtils.createNewLocalRSession(); if (! RUtils.isPackageInstalled(session, "igraph")) { throw new RuntimeException("the igraph package is not installed; the test cannot be done."); } try { assertFalse( "the package should not be loaded by default (at least for this test)", RUtils.isPackageLoaded(session, "igraph") ); RUtils.loadPackage(session, "igraph"); assertTrue( "the package was expected to be loaded after a call to loadPackage", RUtils.isPackageLoaded(session, "igraph") ); } finally { if (session != null) { session.close(); } } }
public static void loadPackage(Rsession session, String name) { session.eval("library("+name+")"); session.loadPackage(name); RUtils.analyzeLastError(session); if (!session.isPackageLoaded(name)) { throw new RRuntimeException("the package "+name+" was not loaded as expected after a loadPackage()"); } }
RUtils { public static void loadPackage(Rsession session, String name) { session.eval("library("+name+")"); session.loadPackage(name); RUtils.analyzeLastError(session); if (!session.isPackageLoaded(name)) { throw new RRuntimeException("the package "+name+" was not loaded as expected after a loadPackage()"); } } }
RUtils { public static void loadPackage(Rsession session, String name) { session.eval("library("+name+")"); session.loadPackage(name); RUtils.analyzeLastError(session); if (!session.isPackageLoaded(name)) { throw new RRuntimeException("the package "+name+" was not loaded as expected after a loadPackage()"); } }  }
RUtils { public static void loadPackage(Rsession session, String name) { session.eval("library("+name+")"); session.loadPackage(name); RUtils.analyzeLastError(session); if (!session.isPackageLoaded(name)) { throw new RRuntimeException("the package "+name+" was not loaded as expected after a loadPackage()"); } }  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 void loadPackage(Rsession session, String name) { session.eval("library("+name+")"); session.loadPackage(name); RUtils.analyzeLastError(session); if (!session.isPackageLoaded(name)) { throw new RRuntimeException("the package "+name+" was not loaded as expected after a loadPackage()"); } }  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);  }