/******************************************************************************* * Copyright (c) 2014, 2016 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.r.scl; import java.util.Arrays; import org.rosuda.REngine.REXP; import org.rosuda.REngine.REXPMismatchException; import org.rosuda.REngine.REngineException; import org.rosuda.REngine.Rserve.RConnection; import org.rosuda.REngine.Rserve.RSession; public class TestRServe { public static void main(String[] args) throws REXPMismatchException, REngineException { RSession session; { RConnection c = new RConnection("130.188.198.138"); c.login("simupedia", "simupedia"); c.assign("a", new double[] {13}); c.assign("b", new double[] {12}); REXP x = c.eval("ls()"); System.out.println(Arrays.toString(x.asStrings())); session = c.detach(); } { RConnection c = session.attach(); c.login("simupedia", "simupedia"); c.assign("c", new double[] {13}); c.assign("d", new double[] {12}); REXP x = c.eval("ls()"); System.out.println(Arrays.toString(x.asStrings())); c.close(); } } }