Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 2514)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 2515)
@@ -108,68 +108,65 @@
  */
 
 public final class RWorkspace {
-
+	
 	/** The comm. */
 	private static RFileCommunication comm;
-
+	
 	/** The connection. */
 	private static RConnection connection = null;
-
+	
 	/** The eval logs. */
-	static ArrayList<String> evalLogs = new ArrayList<String>();
-
+	static ArrayList<String> evalLogs = new ArrayList<>();
+	
 	/** The filecommunication. */
 	private static boolean filecommunication = false;
-
+	
 	// --------------------------------------
 	/** The last safeeval expr. */
 	static String lastSafeevalExpr = ""; //$NON-NLS-1$
-
+	
 	/** The Rserve process. */
 	private static Process RserveProcess = null;
-
+	
 	/** The workspace. */
 	private static RWorkspace workspace = null;
 	
 	/** The error logger. */
 	private StreamHog errorLogger;
-
+	
 	/** The input logger. */
 	private StreamHog inputLogger;
-
+	
 	/** The loggin. */
 	private boolean logging;
-
+	
 	/** The DEFAUL t_ symbol. */
-	//private String DEFAULT_SYMBOL = "txmresult"; //$NON-NLS-1$
-
+	// private String DEFAULT_SYMBOL = "txmresult"; //$NON-NLS-1$
+	
 	/**
 	 * Folder where to create the R working directory
 	 */
 	protected File userdir = null;
-
 	
-	
 	/**
 	 * protected on purpose. See {@link #getRWorkspaceInstance()}.
 	 *
 	 * @throws RWorkspaceException the r workspace exception
 	 */
-	public RWorkspace(File userDir) throws RWorkspaceException {
+	private RWorkspace(File userDir) throws RWorkspaceException {
 		this.userdir = userDir;
 		this.setLog(isLoggingEvalCommandLines());
 	}
-
+	
 	/**
 	 * Append to eval log.
 	 *
 	 * @param cmd the cmd
 	 */
-	public static void appendtoEvalLog(String cmd)
-	{
+	public static void appendtoEvalLog(String cmd) {
 		evalLogs.add(cmd);
 	}
-
+	
 	/**
 	 * Close the connection.
 	 *
@@ -183,7 +180,7 @@
 			connection.close();
 		}
 	}
-
+	
 	/**
 	 * Connect to Rserve.
 	 *
@@ -198,12 +195,13 @@
 			connection = new RConnection(host, port);
 			connection.setStringEncoding("utf8"); // mandatory !
 			return isConnected();
-		} catch (RserveException x) {
+		}
+		catch (RserveException x) {
 			throw new RWorkspaceException(x);
 		}
-
+		
 	}
-
+	
 	/**
 	 * Connect to Rserve.
 	 *
@@ -215,18 +213,19 @@
 	 */
 	public static boolean connect(String host, int port, String user, String password) {
 		try {
-			Log.fine(TXMCoreMessages.bind(RCoreMessages.info_connectingToRAtWithUser, new Object[] {host, port, user}));
+			Log.fine(TXMCoreMessages.bind(RCoreMessages.info_connectingToRAtWithUser, new Object[] { host, port, user }));
 			connection = new RConnection(host, port);
 			connection.login(user, password);
 			connection.setStringEncoding("utf8"); // mandatory !
 			return isConnected();
-
-		} catch (RserveException x) {
-			Log.severe(TXMCoreMessages.bind(RCoreMessages.error_failedToConnectToTheRWorkspace, host, port, user)); 
+			
 		}
+		catch (RserveException x) {
+			Log.severe(TXMCoreMessages.bind(RCoreMessages.error_failedToConnectToTheRWorkspace, host, port, user));
+		}
 		return false;
 	}
-
+	
 	/**
 	 * Gets the last safe eval expr.
 	 *
@@ -235,30 +234,30 @@
 	public static String getLastSafeEvalExpr() {
 		return lastSafeevalExpr;
 	}
-
-
+	
+	
 	/**
 	 * 
 	 * @return
 	 */
 	public static String getRandomSymbol() {
-		return "Random" + UUID.randomUUID(); //$NON-NLS-1$;
+		return "Random" + UUID.randomUUID(); //$NON-NLS-1$ ;
 	}
-
+	
 	/**
 	 * Entering the R workspace.
 	 *
-	 * @param 
+	 * @param
 	 * @return the r workspace instance
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public static final RWorkspace getRWorkspaceInstance() throws RWorkspaceException {
 		if (workspace == null) {
-			//TODO: this method uses the right directory ?
-			//Bundle bundle = FrameworkUtil.getBundle(RWorkspace.class);
-			//File userdir = new File(bundle.getLocation());
+			// TODO: this method uses the right directory ?
+			// Bundle bundle = FrameworkUtil.getBundle(RWorkspace.class);
+			// File userdir = new File(bundle.getLocation());
 			File userDir = new File(Toolbox.getTxmHomePath(), "R");
-			//System.out.println("BUNDLE LOCATION OF '" + bundle.getSymbolicName() + "': " + userDir);
+			// System.out.println("BUNDLE LOCATION OF '" + bundle.getSymbolicName() + "': " + userDir);
 			workspace = new RWorkspace(userDir);
 		}
 		return workspace;
@@ -266,26 +265,30 @@
 	
 	/**
 	 * Post initialisation of Rserve : loads libraries.
-	 * @deprecated The extensions will load themself the packages they need 
+	 * 
+	 * @deprecated The extensions will load themself the packages they need
 	 * @throws RWorkspaceException the r workspace exception
 	 */
+	@Deprecated
 	private static void init() throws RWorkspaceException {
-		String[] packagesToLoad = { }; //$NON-NLS-1$
+		String[] packagesToLoad = {};
 		for (int i = 0; i < packagesToLoad.length; i++) {
 			String name = packagesToLoad[i];
 			try {
 				// System.out.println("load R lib : " + name);
 				connection.eval(("library(" + name + ")")); //$NON-NLS-1$ //$NON-NLS-2$
 				// System.out.println("Done : load R lib : " + name);
-			} catch (RserveException e) {
+			}
+			catch (RserveException e) {
 				throw new RWorkspaceException(NLS.bind(RCoreMessages.error_failedToLoadLibrary, name, e));
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				org.txm.utils.logger.Log.printStackTrace(e);
 			}
 		}
 	}
-
-
+	
+	
 	// --------------------------------------
 	/**
 	 * check R path
@@ -293,8 +296,8 @@
 	 * if not try to launch it.
 	 *
 	 * @param pathToRExecutable the path to r executable
-	 * @param options 
-	 * @param rServeArgs 
+	 * @param options
+	 * @param rServeArgs
 	 * @return true if Rserve is launched
 	 * @throws RWorkspaceException the r workspace exception
 	 */
@@ -306,31 +309,32 @@
 		
 		File execFile = new File(pathToRExecutable);
 		if (!execFile.exists() || pathToRExecutable == null || pathToRExecutable.length() == 0) {
-			//isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
-		//	if (!isRServerOk) {
-				throw new RWorkspaceException(RCoreMessages.error_rservePathNotSet); 
-		//	}
-		} else {
+			// isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
+			// if (!isRServerOk) {
+			throw new RWorkspaceException(RCoreMessages.error_rservePathNotSet);
+			// }
+		}
+		else {
 			isRServerOk = StartRserve.launchRserve(pathToRExecutable, port, debug, rargs, rServeArgs);
 			// System.out.println("ap launchRserve");
 			if (!isRServerOk) {
 				Log.severe(NLS.bind(RCoreMessages.rserveNotStartedUsingTheP0Path, pathToRExecutable));
-				//isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
+				// isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
 			}
 			
 			if (!isRServerOk) {
 				throw new RWorkspaceException(RCoreMessages.bind(RCoreMessages.error_cantFindRServeInPath, pathToRExecutable));
 			}
 		}
-
+		
 		if (isRServerOk) {
 			Log.finest("RSERVE_ACTIVATED"); //$NON-NLS-1$
-			//System.out.println(RCoreMessages.info_connected); 
+			// System.out.println(RCoreMessages.info_connected);
 			RserveProcess = StartRserve.rProcess;
 		}
 		return isRServerOk;
 	}
-
+	
 	/**
 	 * Checks if is connected.
 	 *
@@ -339,11 +343,12 @@
 	private static boolean isConnected() {
 		if (!connection.isConnected()) {
 			return false;
-		} else {
+		}
+		else {
 			return true;
 		}
 	}
-
+	
 	/**
 	 * 
 	 * @return The executable path set in the R Preferences
@@ -360,9 +365,9 @@
 	public static boolean isFileTranfert() {
 		return filecommunication;
 	}
-
 	
 	
+	
 	/**
 	 * Load eval log.
 	 *
@@ -372,13 +377,13 @@
 	public static void loadEvalLog(File file) throws IOException {
 		BufferedReader reader = new BufferedReader(new FileReader(file));
 		String cmd = reader.readLine();
-		while(cmd != null) {
+		while (cmd != null) {
 			evalLogs.add(cmd);
 			cmd = reader.readLine();
 		}
 		reader.close();
 	}
-
+	
 	/**
 	 * Plot.
 	 *
@@ -390,6 +395,7 @@
 	public File plot(File file, String expr) throws REXPMismatchException, StatException, RserveException {
 		return plot(file, expr, "svg");
 	}
+	
 	/**
 	 * Plot.
 	 *
@@ -398,34 +404,34 @@
 	 * @param device the device (svg, png, jpeg, ...)
 	 * @throws REXPMismatchException the rEXP mismatch exception
 	 * @throws StatException the stat exception
-	 * @throws RserveException 
+	 * @throws RserveException
 	 */
-	public File plot(File file, String expr, String devicename) throws REXPMismatchException, StatException, RserveException	{
+	public File plot(File file, String expr, String devicename) throws REXPMismatchException, StatException, RserveException {
 		
 		try {
 			file.createNewFile();
-
+			
 			if (!file.canWrite()) {
 				System.out.println(NLS.bind("{0} cannot be written.", file)); //$NON-NLS-1$
 				return null;
 			}
 			
 			String name;
-			if (OSDetector.isFamilyWindows()) { //$NON-NLS-1$ //$NON-NLS-2$
+			if (OSDetector.isFamilyWindows()) {
 				name = file.getCanonicalPath().replaceAll("/", "\\");
 			}
 			else {
 				name = file.getAbsolutePath();
 			}
-
+			
 			if (devicename.equals("devSVG")) safeEval("library(RSvgDevice);");
-
+			
 			// FIXME : test for window dimensions so the large plots can be entirely displayed. Need to pass width and height to RWorkspace.plot() so
 			// RChartsEngine will be able to dynamically compute the width from the number of bars in a barplot for example.
-			//REXP xp = eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
-			REXP xp = eval("try("+devicename+"(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+			// REXP xp = eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			
+			REXP xp = eval("try(" + devicename + "(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			
 			if (xp.isString() && xp.asString() != null) { // if there's a string
 				// then we have a
 				// problem, R sent an
@@ -437,7 +443,7 @@
 				// if (w.asString()!=null) System.out.println(w.asString());
 				throw new StatException(w.asString());
 			}
-
+			
 			// ok, so the device should be fine - let's plot
 			safeEval(expr);
 			safeEval("dev.off()"); //$NON-NLS-1$
@@ -457,7 +463,7 @@
 	public static void printLastSafeEvalExpr() {
 		Log.fine(RCoreMessages.bind(RCoreMessages.info_lastSafeEvalExpression, lastSafeevalExpr));
 	}
-
+	
 	/**
 	 * Save eval log.
 	 *
@@ -467,11 +473,11 @@
 	public static void saveEvalLog(File file) throws IOException {
 		FileWriter writer = new FileWriter(file);
 		for (String cmd : evalLogs)
-			writer.write(cmd+"\n"); //$NON-NLS-1$
+			writer.write(cmd + "\n"); //$NON-NLS-1$
 		writer.flush();
 		writer.close();
 	}
-
+	
 	/**
 	 * if state is true, the matrix will be send to R with a File.
 	 *
@@ -483,7 +489,8 @@
 		if (filecommunication) {
 			try {
 				comm = new RFileCommunication();
-			} catch (IOException e) {
+			}
+			catch (IOException e) {
 				filecommunication = false;
 				Log.severe(RCoreMessages.bind(RCoreMessages.error_failedToInitializeFileTransfert, Log.toString(e)));
 				return false;
@@ -491,7 +498,7 @@
 		}
 		return true;
 	}
-
+	
 	/**
 	 * Close the connection and destroy the Rserve process.
 	 *
@@ -502,7 +509,7 @@
 			// If no R object have been created during the lif ecycle of the
 			// application,
 			// the connection has never been initialized.
-
+			
 			if (connection != null && connection.isConnected()) {
 				// connection.close(); // No: invoquing "close()" make
 				// "shutdown()" to throw a "not connected" exception.
@@ -513,17 +520,18 @@
 				// ok but using it yield to a
 				// "Broken pipe" exception.
 			}
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			throw new RWorkspaceException(e);
 		}
 	}
-
+	
 	/**
 	 * Start exec.
 	 *
 	 * @param pathToRExecutable the path to r executable
-	 * @param string 
-	 * @param string 
+	 * @param string
+	 * @param string
 	 * @return true, if successful
 	 */
 	public static boolean startExec(String pathToRExecutable, int port, boolean debug, String rArgs, String rServeArgs) {
@@ -531,13 +539,14 @@
 		try {
 			initRserve(pathToRExecutable, port, debug, rArgs, rServeArgs);
 			return true;
-		} catch (RWorkspaceException e) {
+		}
+		catch (RWorkspaceException e) {
 			Log.severe(RCoreMessages.error_failedToStartRServe);
 			org.txm.utils.logger.Log.printStackTrace(e);
 		}
 		return false;
 	}
-
+	
 	/**
 	 * To double.
 	 *
@@ -548,13 +557,14 @@
 	public static final double[] toDouble(REXP rexp) throws RWorkspaceException {
 		try {
 			return rexp.asDoubles();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 	}
-
-
-
+	
+	
+	
 	/**
 	 * Add a matrix into the workspace and link it to a name. The inner arrays
 	 * of the <code>matrix</code> parameters are the <strong>row</strong> of the
@@ -562,12 +572,12 @@
 	 *
 	 * @param variableName the name to be used in the R workspace.
 	 * @param matrix the data to be bound to the name. In the form
-	 * <code>matrix[row][column]</code>, with exactly the same number
-	 * of column in every row.
+	 *            <code>matrix[row][column]</code>, with exactly the same number
+	 *            of column in every row.
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addMatrixToWorkspace(String variableName, double[][] matrix) throws RWorkspaceException {
-		//System.out.println("matrix len: "+matrix.length+" test="+(matrix.length == 0));
+		// System.out.println("matrix len: "+matrix.length+" test="+(matrix.length == 0));
 		if (matrix.length == 0) {
 			new RWorkspaceException(RCoreMessages.error_matrixIsEmpty);
 		}
@@ -584,33 +594,36 @@
 	 *
 	 * @param variableName the name to be used in the R workspace.
 	 * @param matrix the data to be bound to the name. In the form
-	 * <code>matrix[row][column]</code>, with exactly the same number
-	 * of column in every row.
+	 *            <code>matrix[row][column]</code>, with exactly the same number
+	 *            of column in every row.
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addMatrixToWorkspace(String variableName, double[][] matrix, int ncol, int nrow)
 			throws RWorkspaceException {
-
+		
 		double[] vector = VectorizeArray.vectorizeByInner(matrix);
-
+		
 		if (!filecommunication) {
 			try {
 				connection.assign(variableName, vector);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 			try {
-				connection .voidEval(variableName
+				connection.voidEval(variableName
 						+ "<- matrix(" + variableName + ", nrow=" + nrow + ", ncol=" + ncol + ", byrow=T)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			} catch (RserveException e) {
+			}
+			catch (RserveException e) {
 				throw new RWorkspaceException(e);
 			}
-		} else {
+		}
+		else {
 			comm.assign(variableName, vector, nrow, ncol);
 		}
 		Log.finest("MATRIX_ADDED_TO_WORKSPACE" + new Object[] { nrow, ncol, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Add a matrix into the workspace and link it to a name. Intended to be
 	 * efficient for sparse matrix.
@@ -621,10 +634,10 @@
 	 */
 	public void addMatrixToWorkspace(String variableName, DoubleMatrix2D matrix)
 			throws RWorkspaceException {
-
+		
 		double[][] data = RColt.doubleMatrix2D2DoubleDoubleArray(matrix);
 		addMatrixToWorkspace(variableName, data, matrix.columns(), matrix.rows());
-
+		
 		// // IntArrayList x = new IntArrayList();
 		// // IntArrayList y = new IntArrayList();
 		// // DoubleArrayList val = new DoubleArrayList();
@@ -647,7 +660,7 @@
 		// // System.out.println(x);
 		// // System.out.println(y);
 		// // System.out.println(val);
-		//		
+		//
 		// int nrow = matrix.rows();
 		// int ncol = matrix.columns();
 		// // System.out.println(matrix);
@@ -677,19 +690,19 @@
 		// y.getQuick(j) + "] <- " + val.getQuick(i * 5 + * j));
 		// // }
 		// // }
-		//			
+		//
 		// } catch (RserveException e) {
 		// throw new RWorkspaceException(e);
 		// }
-		//		
+		//
 		// removeVariableFromWorkspace(variableName + ".nonzero");
 		// removeVariableFromWorkspace(variableName + ".x");
 		// removeVariableFromWorkspace(variableName + ".y");
-		//		
-		//		
+		//
+		//
 		// System.out.println("--------------matrice d'origine----------");
 		// System.out.println(matrix);
-		//		
+		//
 		// // DoubleFactory2D.dense.make(arg0)
 		// System.out.println("--------------matrice issue de R----------");
 		// DenseDoubleMatrix2D m = null;
@@ -704,33 +717,33 @@
 		// org.txm.utils.logger.Log.printStackTrace(e);
 		// }
 		// System.out.println(m);
-
+		
 	}
-
-//TODO: is addLexiconToWorkspace used ?
-//	/**
-//	 * Adds the lexicon to workspace.
-//	 *
-//	 * @param variableName the variable name
-//	 * @param lexicon the lexicon
-//	 * @throws RWorkspaceException the r workspace exception
-//	 */
-//	public void addLexiconToWorkspace(String variableName, Lexicon lexicon)
-//			throws RWorkspaceException {
-//		int[] freqs = lexicon.getFreq();
-//		String[] forms = lexicon.getForms();
-//		try {
-//			addVectorToWorkspace(variableName, freqs);
-//			addVectorToWorkspace(variableName + "_names", forms); //$NON-NLS-1$
-//			connection
-//			.voidEval("names(" + variableName + ") <- " + variableName + "_names"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-//			connection.voidEval("rm(" + variableName + "_names" + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-//		} catch (RserveException e) {
-//			throw new RWorkspaceException(e);
-//		}
-//		Log.finest("LEXICON_ADDED" + new Object[] { lexicon.nbrOfType() + variableName }); //$NON-NLS-1$
-//	}
-
+	
+	// TODO: is addLexiconToWorkspace used ?
+	// /**
+	// * Adds the lexicon to workspace.
+	// *
+	// * @param variableName the variable name
+	// * @param lexicon the lexicon
+	// * @throws RWorkspaceException the r workspace exception
+	// */
+	// public void addLexiconToWorkspace(String variableName, Lexicon lexicon)
+	// throws RWorkspaceException {
+	// int[] freqs = lexicon.getFreq();
+	// String[] forms = lexicon.getForms();
+	// try {
+	// addVectorToWorkspace(variableName, freqs);
+	// addVectorToWorkspace(variableName + "_names", forms); //$NON-NLS-1$
+	// connection
+	// .voidEval("names(" + variableName + ") <- " + variableName + "_names"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	// connection.voidEval("rm(" + variableName + "_names" + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	// } catch (RserveException e) {
+	// throw new RWorkspaceException(e);
+	// }
+	// Log.finest("LEXICON_ADDED" + new Object[] { lexicon.nbrOfType() + variableName }); //$NON-NLS-1$
+	// }
+	
 	/**
 	 * Add a matrix into the workspace and link it to a name. The inner arrays
 	 * of the <code>matrix</code> parameters are the <strong>row</strong> of the
@@ -738,8 +751,8 @@
 	 *
 	 * @param variableName the name to be used in the R workspace.
 	 * @param matrix the data to be bound to the name. In the form
-	 * <code>matrix[row][column]</code>, with exactly the same number
-	 * of column in every row.
+	 *            <code>matrix[row][column]</code>, with exactly the same number
+	 *            of column in every row.
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addMatrixToWorkspace(String variableName, int[][] matrix) throws RWorkspaceException {
@@ -752,6 +765,7 @@
 		
 		addMatrixToWorkspace(variableName, matrix, ncol, nrow);
 	}
+	
 	/**
 	 * Add a matrix into the workspace and link it to a name. The inner arrays
 	 * of the <code>matrix</code> parameters are the <strong>row</strong> of the
@@ -759,8 +773,8 @@
 	 *
 	 * @param variableName the name to be used in the R workspace.
 	 * @param matrix the data to be bound to the name. In the form
-	 * <code>matrix[row][column]</code>, with exactly the same number
-	 * of column in every row.
+	 *            <code>matrix[row][column]</code>, with exactly the same number
+	 *            of column in every row.
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addMatrixToWorkspace(String variableName, int[][] matrix, int ncol, int nrow) throws RWorkspaceException {
@@ -769,7 +783,8 @@
 		if (!filecommunication) {
 			try {
 				connection.assign(variableName, vector);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 			try {
@@ -777,8 +792,9 @@
 				
 				Log.finest("MATRIX_ADDED_TO_WORKSPACE: " + command); //$NON-NLS-1$
 				
-				connection.voidEval(command); 
-			} catch (RserveException e) {
+				connection.voidEval(command);
+			}
+			catch (RserveException e) {
 				throw new RWorkspaceException(e);
 			}
 		}
@@ -787,7 +803,7 @@
 		}
 		Log.finest("MATRIX_ADDED_TO_WORKSPACE" + new Object[] { nrow, ncol, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Adds the vector to workspace.
 	 *
@@ -802,14 +818,15 @@
 		else {
 			try {
 				connection.assign(variableName, vector);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 		}
-
+		
 		Log.finest("DOUBLE_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Add a vector into the workspace and link it to a name.
 	 *
@@ -818,7 +835,7 @@
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addVectorToWorkspace(String variableName, DoubleArrayList vector) throws RWorkspaceException {
-
+		
 		vector.trimToSize();
 		double[] vald = vector.elements();
 		if (filecommunication) {
@@ -827,13 +844,14 @@
 		else {
 			try {
 				connection.assign(variableName, vald);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 		}
 		Log.finest("DOUBLE_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vald.length, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Adds the vector to workspace.
 	 *
@@ -842,21 +860,22 @@
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addVectorToWorkspace(String variableName, int[] vector) throws RWorkspaceException {
-		//checkForDuplicateVariable(variableName);
+		// checkForDuplicateVariable(variableName);
 		if (filecommunication) {
 			comm.assign(variableName, vector);
 		}
 		else {
 			try {
 				connection.assign(variableName, vector);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 		}
-
+		
 		Log.finest("INT_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Adds the vector to workspace.
 	 *
@@ -869,19 +888,21 @@
 		int[] vald = vector.elements();
 		if (filecommunication) {
 			comm.assign(variableName, vald);
-		} else {
+		}
+		else {
 			try {
 				connection.assign(variableName, vald);
-			} catch (REngineException e) {
+			}
+			catch (REngineException e) {
 				throw new RWorkspaceException(e);
 			}
 		}
-
+		
 		Log.finest("INT_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vald.length, variableName }); //$NON-NLS-1$
 	}
-
+	
 	// --------------------------------------
-
+	
 	/**
 	 * Adds the vector to workspace.
 	 *
@@ -890,16 +911,17 @@
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public void addVectorToWorkspace(String variableName, String[] vector) throws RWorkspaceException {
-
+		
 		try {
 			connection.assign(variableName, vector);
-		} catch (REngineException e) {
+		}
+		catch (REngineException e) {
 			throw new RWorkspaceException(e);
 		}
-
+		
 		Log.finest("CHAR_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Assign col names to matrix.
 	 *
@@ -910,7 +932,7 @@
 	public void assignColNamesToMatrix(String matrix, String colNames) throws RWorkspaceException {
 		voidEval("colnames(" + matrix + ") <- " + colNames); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-
+	
 	/**
 	 * Assign row names to matrix.
 	 *
@@ -922,7 +944,7 @@
 			throws RWorkspaceException {
 		voidEval("rownames(" + matrix + ") <- " + rowNames); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-
+	
 	/**
 	 * Builds the string args.
 	 *
@@ -936,16 +958,17 @@
 			if (arguments[i] == null) { // null may be used for specif ying
 				// "NULL" R object.
 				arguments_as_string[i] = "NULL"; //$NON-NLS-1$
-			} else {
+			}
+			else {
 				if (!containsVariable(arguments[i].getSymbol())) {
-					throw new RWorkspaceException(NLS.bind(RCoreMessages.error_requestedObjectNotFoundInR, arguments[i].getSymbol())); 
+					throw new RWorkspaceException(NLS.bind(RCoreMessages.error_requestedObjectNotFoundInR, arguments[i].getSymbol()));
 				}
 				arguments_as_string[i] = arguments[i].getSymbol();
 			}
 		}
 		return arguments_as_string;
 	}
-
+	
 	/**
 	 * Call a function, with an array of {@link QuantitativeDataStructure}.
 	 * 
@@ -965,7 +988,7 @@
 		String[] arguments_as_string = buildStringArgs(arguments);
 		return callFunction(functionName, arguments_as_string);
 	}
-
+	
 	/**
 	 * Call a function, with an array of {@link QuantitativeDataStructure}.
 	 * 
@@ -986,7 +1009,7 @@
 		String[] arguments_as_string = buildStringArgs(arguments);
 		return callFunctionAndAffect(functionName, arguments_as_string, symbol);
 	}
-
+	
 	/**
 	 * See {@link #callFunction(String, String[])}.
 	 *
@@ -998,7 +1021,7 @@
 	public REXP callFunction(String functionName, String argument) throws RWorkspaceException {
 		return callFunction(functionName, new String[] { argument });
 	}
-
+	
 	/**
 	 * Call a function, with a list of non-named parameters, and return the
 	 * result as a <code>REXP</code> object.
@@ -1010,10 +1033,10 @@
 	 */
 	public REXP callFunction(String functionName, String[] arguments)
 			throws RWorkspaceException {
-		//return eval(makeFunctionCall(functionName, arguments));
+		// return eval(makeFunctionCall(functionName, arguments));
 		return callFunctionAndAffect(functionName, arguments, "txmresult"); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Same as {@link #callFunction(String, String[])}, but affect the result to
 	 * a R name in the R workspace.
@@ -1025,7 +1048,7 @@
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public REXP callFunctionAndAffect(String functionName, String[] arguments, String symbol) throws RWorkspaceException {
-		//symbol must be well formed
+		// symbol must be well formed
 		if (symbol.length() == 0) {
 			symbol = "txmresult"; //$NON-NLS-1$
 		}
@@ -1035,7 +1058,7 @@
 		sb.append(makeFunctionCall(functionName, arguments));
 		return eval(sb.toString());
 	}
-
+	
 	/**
 	 * Check for duplicate variable.
 	 *
@@ -1048,8 +1071,8 @@
 			throw new RObjectAlreadyExist("Duplicate variable name: " + variableName + ". Existing variables: " + Arrays.toString(this.getExistingVariableName())); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
-
-
+	
+	
 	/**
 	 * Remove all variables from workspace.
 	 *
@@ -1058,12 +1081,13 @@
 	public void clearWorkspace() throws RWorkspaceException {
 		try {
 			connection.voidEval("rm(list=ls(), inherits=FALSE)"); //$NON-NLS-1$
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			throw new RWorkspaceException(e);
 		}
 		Log.finest("R WORKSPACE_PURGED"); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * connect to Rserve using the defaults address and port 127.0.0.1:6311
 	 *
@@ -1073,7 +1097,7 @@
 	private boolean connect() throws RWorkspaceException {
 		return connect("127.0.0.1", 6311); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Test if a variable exists in the R workspace. A variable exists in the R
 	 * workspace if the R function <code>exists</code> return true on that
@@ -1081,7 +1105,7 @@
 	 *
 	 * @param variableName the variable supposed to exists in the R workspace.
 	 * @return <code>true</code> if the variable exist, <code>false</code>
-	 * otherwise.
+	 *         otherwise.
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public boolean containsVariable(String variableName)
@@ -1089,7 +1113,8 @@
 		REXP res = null;
 		try {
 			res = connection.eval("exists(\"" + variableName + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			throw new RWorkspaceException(e);
 		}
 		if (res.isLogical() && ((REXPLogical) res).isTRUE()[0]) {
@@ -1097,7 +1122,7 @@
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Bar delegate call to {@link Rengine#eval(String)}.
 	 * 
@@ -1112,16 +1137,18 @@
 		REXP res = null;
 		try {
 			res = safeEval(exp);
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			RWorkspace.printLastSafeEvalExpr();
 			throw new RWorkspaceException(e);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RException(exp + "; " + e.getMessage(), e); //$NON-NLS-1$
 		}
-
+		
 		return res;
 	}
-
+	
 	/**
 	 * Eval to double.
 	 *
@@ -1133,19 +1160,20 @@
 		double[] res = null;
 		try {
 			res = eval(exp).asDoubles();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 		return res;
 	}
-
+	
 	// public REXP safeVoidEval(String s) throws RserveException, RException,
 	// REXPMismatchException {
 	// REXP r = connection.voidEval("try({" + s + "}, silent=TRUE)");
 	// if (r.inherits("try-error")) throw new RException(r.asString());
 	// return r;
 	// }
-
+	
 	/**
 	 * Eval to double2 d.
 	 *
@@ -1157,15 +1185,15 @@
 		double[][] res = null;
 		try {
 			res = eval(exp).asDoubleMatrix();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 		return res;
 	}
-
+	
 	/*
 	 * Eval to int 2d.
-	 *
 	 * @param exp the exp
 	 * @return the double[][]
 	 * @throws RWorkspaceException the r workspace exception
@@ -1176,21 +1204,22 @@
 			int[] dims = eval("dim(" + exp + ")").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
 			int ncol = dims[1];
 			int nrow = dims[0];
-			int[] tmp = eval("c("+exp+")").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
-
+			int[] tmp = eval("c(" + exp + ")").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
+			
 			int c = 0;
 			res = new int[nrow][ncol];
-			for (int i = 0 ; i < ncol ; i++) {
-				for (int j = 0 ; j < nrow ; j++) {
+			for (int i = 0; i < ncol; i++) {
+				for (int j = 0; j < nrow; j++) {
 					res[j][i] = tmp[c++];
 				}
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 		return res;
 	}
-
+	
 	/**
 	 * Eval to string.
 	 *
@@ -1202,12 +1231,13 @@
 		String[] res = null;
 		try {
 			res = eval(exp).asStrings();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 		return res;
 	}
-
+	
 	/**
 	 * Extract item from list by name.
 	 *
@@ -1219,12 +1249,13 @@
 	public REXP extractItemFromListByName(REXP list, String item_name) throws RWorkspaceException {
 		try {
 			return list.asList().at(item_name);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(RCoreMessages.error_errorDuringItemsListExtraction
-					+ e.getMessage()); 
+					+ e.getMessage());
 		}
 	}
-
+	
 	/**
 	 * Extract item from list by name.
 	 *
@@ -1236,7 +1267,7 @@
 	public REXP extractItemFromListByName(String list_symbol, String item_name) throws RWorkspaceException {
 		return eval(list_symbol + RConstant.LIST_EXTRACTOR + item_name);
 	}
-
+	
 	/**
 	 * Gets the connection.
 	 *
@@ -1245,13 +1276,13 @@
 	public RConnection getConnection() {
 		return connection;
 	}
-
+	
 	public StreamHog getErrorLogger() {
 		return errorLogger;
 	}
-
+	
 	// --------------------------------------
-
+	
 	/**
 	 * Gets the existing variable name.
 	 *
@@ -1262,22 +1293,24 @@
 		REXP res;
 		try {
 			res = connection.eval("ls()"); //$NON-NLS-1$
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			throw new RWorkspaceException(e);
 		}
 		try {
 			return res.asStrings();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RWorkspaceException(e);
 		}
 	}
-
+	
 	// --------------------------------------
-
+	
 	public StreamHog getInputLogger() {
 		return inputLogger;
 	}
-
+	
 	/**
 	 * Gets the last error line.
 	 *
@@ -1286,7 +1319,7 @@
 	public String getLastErrorLine() {
 		return this.errorLogger.lastline;
 	}
-
+	
 	/**
 	 * Gets the last log line.
 	 *
@@ -1295,9 +1328,10 @@
 	public String getLastLogLine() {
 		return this.inputLogger.lastline;
 	}
-
+	
 	/**
-	 * Initializes the R connection configuration (time out and proxy configuration, if needed). 
+	 * Initializes the R connection configuration (time out and proxy configuration, if needed).
+	 * 
 	 * @param conf
 	 * @throws RserveException
 	 */
@@ -1314,7 +1348,7 @@
 			this.getConnection().eval("Sys.setenv(http_proxy=\"" + proxyUrl + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
-
+	
 	/**
 	 * Checks if is logging.
 	 *
@@ -1324,9 +1358,9 @@
 		// TODO Auto-generated method stub
 		return logging;
 	}
-
+	
 	// --------------------------------------
-
+	
 	/**
 	 * Make function call.
 	 *
@@ -1347,7 +1381,7 @@
 		sb.append(RConstant.CLOSE_PAREN);
 		return sb.toString();
 	}
-
+	
 	@SuppressWarnings("rawtypes")
 	/**
 	 * Post configuration.
@@ -1360,51 +1394,54 @@
 		try {
 			// more logs
 			connection.eval("try(options(max.print=5000))"); //$NON-NLS-1$
-
+			
 			// set TXM R workspace directory
-			File RWorkspaceDirectory = new File(userdir, "R"); //$NON-NLS-1$
-			RWorkspaceDirectory.mkdir();
-			if (!RWorkspaceDirectory.exists()) {
-				System.out.println("TXM R workspace directory not found: "+RWorkspaceDirectory);
-			} else {
-				Log.fine("Setting TXM R workspace directory: "+RWorkspaceDirectory.getAbsolutePath());
-				connection.eval("setwd(\""+RWorkspaceDirectory.getAbsolutePath().replace("\\", "/")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			userdir.mkdirs();
+			if (!userdir.exists()) {
+				System.out.println("TXM R workspace directory not found: " + userdir);
 			}
-
-			File RLibrariesWorkspaceDirectory = new File(RWorkspaceDirectory, "libraries");
+			else {
+				Log.fine("Setting TXM R workspace directory: " + userdir.getAbsolutePath());
+				connection.eval("setwd(\"" + userdir.getAbsolutePath().replace("\\", "/") + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			}
+			
+			File RLibrariesWorkspaceDirectory = new File(userdir, "libraries");
 			RLibrariesWorkspaceDirectory.mkdir();
 			if (!RLibrariesWorkspaceDirectory.exists()) {
-				System.out.println("TXM R libraries workspace directory not found: "+RLibrariesWorkspaceDirectory);
-			} else {
-				Log.fine("Setting TXM R libraries workspace directory: "+RLibrariesWorkspaceDirectory.getAbsolutePath());
-				connection.eval(".libPaths(c(\""+RLibrariesWorkspaceDirectory.getAbsolutePath().replace("\\", "/")+"\",.libPaths()))");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				System.out.println("TXM R libraries workspace directory not found: " + RLibrariesWorkspaceDirectory);
 			}
-
-			if (OSDetector.isFamilyWindows())	{
+			else {
+				Log.fine("Setting TXM R libraries workspace directory: " + RLibrariesWorkspaceDirectory.getAbsolutePath());
+				connection.eval(".libPaths(c(\"" + RLibrariesWorkspaceDirectory.getAbsolutePath().replace("\\", "/") + "\",.libPaths()))");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			}
+			
+			if (OSDetector.isFamilyWindows()) {
 				rPackagesPath = rPackagesPath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
 			}
-
+			
 			// set proxy configuration using detected system proxy if exists
 			SystemProxyDetector conf = new SystemProxyDetector();
 			this.initializeRWorkspaceConnectionConfiguration(conf);
-
+			
 			// load R libraries: this is now done by extensions/commands themself
 			try {
 				init(); // load libs
-			} catch (RWorkspaceException e) {
+			}
+			catch (RWorkspaceException e) {
 				org.txm.utils.logger.Log.printStackTrace(e);
 				return false;
 			}
-
-			//connection.eval("try(.libPaths(\"" + rPackagesPath + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$
-
+			
+			// connection.eval("try(.libPaths(\"" + rPackagesPath + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$
+			
 			return true;
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			org.txm.utils.logger.Log.printStackTrace(e);
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Start logger.
 	 *
@@ -1417,7 +1454,7 @@
 		this.inputLogger = streamHog2;
 		return null;
 	}
-
+	
 	/**
 	 * Remove a variable from the workspace. The content is lost, and the name
 	 * refers to nothing.
@@ -1431,19 +1468,20 @@
 		
 		try {
 			connection.voidEval("rm(" + variableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			throw new RWorkspaceException(e);
 		}
 		Log.finest("R VARIABLE_REMOVED: " + new Object[] { variableName }); //$NON-NLS-1$
 	}
-
+	
 	/**
 	 * Casts the specified REXP to a displayable object.
 	 * 
 	 * @param rexp
 	 * @return the casted object : String, int, etc.
 	 */
-	public Object getCastedREXP(REXP rexp)	{
+	public Object getCastedREXP(REXP rexp) {
 		try {
 			if (rexp instanceof org.rosuda.REngine.REXPString) {
 				if (rexp.isVector()) {
@@ -1451,8 +1489,8 @@
 				}
 				else {
 					return rexp.asString();
-				} 
-			} 
+				}
+			}
 			else if (rexp instanceof org.rosuda.REngine.REXPDouble) {
 				if (rexp.isVector()) {
 					return Arrays.toString(rexp.asDoubles());
@@ -1490,23 +1528,23 @@
 	 * @throws REXPMismatchException the rEXP mismatch exception
 	 */
 	public REXP safeEval(String expr) throws RserveException, RException, REXPMismatchException {
-		if (logging && inputLogger != null ) {
+		if (logging && inputLogger != null) {
 			inputLogger.printMessage(expr);
 		}
 		lastSafeevalExpr = expr;
 		
 		expr = "try({" + expr + "}, silent=FALSE)";
 		
-		if(isLoggingEvalCommandLines())	{
-			//TODO SJ: for debuggin puprose
-			//Log.info("R safeEval: " + expr, 8); //$NON-NLS-1$
+		if (isLoggingEvalCommandLines()) {
+			// TODO SJ: for debuggin puprose
+			// Log.info("R safeEval: " + expr, 8); //$NON-NLS-1$
 			Log.info("R safeEval: " + expr); //$NON-NLS-1$
 		}
 		
 		REXP r = null;
 		try {
 			r = connection.eval(expr);
-			if(isLoggingEvalCommandLines())	{
+			if (isLoggingEvalCommandLines()) {
 				Log.info(" return: " + this.getCastedREXP(r)); //$NON-NLS-1$
 			}
 		}
@@ -1514,17 +1552,17 @@
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-		finally	{
-			if (r !=null && r.inherits("try-error")) {
-				throw new RException(expr, r.asString()); //$NON-NLS-1$
+		finally {
+			if (r != null && r.inherits("try-error")) {
+				throw new RException(expr, r.asString());
 			}
 		}
 		return r;
 	}
-
 	
+	
 	/**
-
+	 * 
 	 * Bar delegate call to {@link Connection#voidEval(String)}.
 	 * 
 	 * It is up to the caller to check if everything goes well (testing if the
@@ -1537,60 +1575,70 @@
 	public String userEval(String exp) throws RWorkspaceException {
 		if (exp.trim().length() == 0)
 			return ""; //$NON-NLS-1$
-		//if (loggin)
-		//System.out.println("R>"+exp); //$NON-NLS-1$
-
+		// if (loggin)
+		// System.out.println("R>"+exp); //$NON-NLS-1$
+		
 		if (exp.endsWith(";")) //$NON-NLS-1$
-			exp = exp.substring(0, exp.length()-1);
-
-		//		String trybegin = "try("; //$NON-NLS-1$
-		//		String tryend = ")"; //$NON-NLS-1$
-
+			exp = exp.substring(0, exp.length() - 1);
+		
+		// String trybegin = "try("; //$NON-NLS-1$
+		// String tryend = ")"; //$NON-NLS-1$
+		
 		String out = null;
 		try {
-			if (isLoggingEvalCommandLines())	{
-				Log.info("R userEval: " + exp ); //$NON-NLS-1$
+			if (isLoggingEvalCommandLines()) {
+				Log.info("R userEval: " + exp); //$NON-NLS-1$
 			}
-			//out = connection.eval("paste(capture.output(print(" + trybegin + trybegin +"("+ exp+")" + tryend + tryend + ")),collapse=\"\\n\")").asString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			//String cmd = "paste(capture.output(print(" + trybegin + "("+ exp+")" + tryend + ")),collapse=\"\\n\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			REXP ret = connection.eval(exp); 
-			//REXP ret = connection.eval(exp);
-
+			// out = connection.eval("paste(capture.output(print(" + trybegin + trybegin +"("+ exp+")" + tryend + tryend + ")),collapse=\"\\n\")").asString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			// //$NON-NLS-4$
+			// String cmd = "paste(capture.output(print(" + trybegin + "("+ exp+")" + tryend + ")),collapse=\"\\n\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			REXP ret = connection.eval(exp);
+			// REXP ret = connection.eval(exp);
+			
 			if (ret instanceof org.rosuda.REngine.REXPString) {
 				if (ret.isVector()) {
-					out =  "result: "+StringUtils.join(ret.asStrings(), ", ");
-				} else {
-					out =  "result: "+ret.asString();
-				} 
-			} else if (ret instanceof org.rosuda.REngine.REXPDouble) {
+					out = "result: " + StringUtils.join(ret.asStrings(), ", ");
+				}
+				else {
+					out = "result: " + ret.asString();
+				}
+			}
+			else if (ret instanceof org.rosuda.REngine.REXPDouble) {
 				if (ret.isVector()) {
-					out = "result: "+ret.asDouble();
-				} else {
-					out =  "result: "+Arrays.toString(ret.asDoubles());
+					out = "result: " + ret.asDouble();
 				}
-			}  else if (ret instanceof org.rosuda.REngine.REXPInteger) {
+				else {
+					out = "result: " + Arrays.toString(ret.asDoubles());
+				}
+			}
+			else if (ret instanceof org.rosuda.REngine.REXPInteger) {
 				if (ret.isVector()) {
-					out = "result: "+ret.asInteger();
-				} else {
-					out =  "result: "+Arrays.toString(ret.asIntegers());
+					out = "result: " + ret.asInteger();
 				}
-			} else if (ret instanceof org.rosuda.REngine.REXPNull) {
-				out =  "NULL";
-			} else {
-				out =  "result: "+ret;
+				else {
+					out = "result: " + Arrays.toString(ret.asIntegers());
+				}
 			}
+			else if (ret instanceof org.rosuda.REngine.REXPNull) {
+				out = "NULL";
+			}
+			else {
+				out = "result: " + ret;
+			}
 			
-		} catch (RserveException e) {
+		}
+		catch (RserveException e) {
 			System.out.println(NLS.bind(RCoreMessages.error_evaluationError, e.getMessage(), exp));
 			Log.printStackTrace(e);
-		} catch (Exception e) {
-			System.out.println("REXPMismatchException: "+e);
+		}
+		catch (Exception e) {
+			System.out.println("REXPMismatchException: " + e);
 			Log.printStackTrace(e);
 		}
 		
 		return out;
 	}
-
+	
 	/**
 	 * Bar delegate call to {@link Connection#voidEval(String)}.
 	 * 
@@ -1601,9 +1649,9 @@
 	 * @throws RWorkspaceException the r workspace exception
 	 */
 	public boolean voidEval(String exp) throws RWorkspaceException {
-
+		
 		if (exp.endsWith(";")) //$NON-NLS-1$
-			exp = exp.substring(0, exp.length()-1);
+			exp = exp.substring(0, exp.length() - 1);
 		
 		try {
 			safeEval(exp);
@@ -1618,18 +1666,20 @@
 	
 	/**
 	 * Checks if the eval command lines preference is set
+	 * 
 	 * @return
 	 */
-	public static boolean isLoggingEvalCommandLines()	{
-		return RPreferences.getInstance().getBoolean(RPreferences.SHOW_EVAL_LOGS); 
+	public static boolean isLoggingEvalCommandLines() {
+		return RPreferences.getInstance().getBoolean(RPreferences.SHOW_EVAL_LOGS);
 	}
 	
 	/**
 	 * Checks if the debug mode preference is set.
+	 * 
 	 * @return
 	 */
-	public static boolean isDebugMode()	{
-		return RPreferences.getInstance().getBoolean(RPreferences.DEBUG); 
+	public static boolean isDebugMode() {
+		return RPreferences.getInstance().getBoolean(RPreferences.DEBUG);
 	}
 	
 	/**
@@ -1637,15 +1687,14 @@
 	 *
 	 * @param start the new log
 	 */
-	public void setLog(boolean start)
-	{
+	public void setLog(boolean start) {
 		logging = start;
 		if (errorLogger != null)
 			this.errorLogger.setPrint(start);
 		if (inputLogger != null)
 			this.inputLogger.setPrint(start);
 	}
-
+	
 	/**
 	 * To txt.
 	 *
@@ -1656,15 +1705,16 @@
 	public void toTxt(File file, String symbol) throws StatException {
 		eval("write.table(" + symbol + file.getAbsolutePath().replace("\\", "\\\\")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 	}
-
-
 	
+	
+	
 	/**
 	 * Loads a package library from its name.
+	 * 
 	 * @param p
 	 * @throws RWorkspaceException
 	 */
 	public void loadPackage(String p) throws RWorkspaceException {
-		this.eval("library(\""+p+"\")"); //$NON-NLS-1$ //$NON-NLS-2$
+		this.eval("library(\"" + p + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-}
\ No newline at end of file
+}
