com.github.rcaller.rstuff.RService Maven / Gradle / Ivy
package com.github.rcaller.rstuff;
public class RService {
public static String type_String = "[Ljava.lang.String;";
public static String type_double = "[Ljava.lang.double;";
public static String type_Integer = "[Ljava.lang.Integer;";
private RCaller rcaller = null;
private RCode rcode = null;
public RService(){
rcaller = RCaller.create();
rcode = RCode.create();
rcaller.setRCode(rcode);
}
public RCaller getRCaller(){
return(this.rcaller);
}
public RCode getRCode(){
return(this.rcode);
}
public Object[] get(String var, String command, String type){
rcode.addRCode(var + " <- " +command);
rcaller.runAndReturnResultOnline(var);
if (type.equals(type_String)) {
return(rcaller.getParser().getAsStringArray(var));
} else if (type.equals(type_Integer)) {
int[] res = rcaller.getParser().getAsIntArray(var);
Integer[] ints = new Integer[res.length];
for (int i=0;i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy