package core; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class RReader { //Program read an R script and runs it via command line. Thus, it needs the location of Rscript.exe, the location of //the specific script that should be run and the arguments that are needed for that R program public static void readRScript(String R_location, String R_programLocation, String argument) throws IOException{ Runtime rt = Runtime.getRuntime(); String commands = R_location + " " + R_programLocation + " " + argument; Process proc = rt.exec(commands); BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String tempRoutput = ""; String s = null; while ((s = stdInput.readLine()) != null) { tempRoutput = tempRoutput.concat(s).concat("~"); } String[] Routput = tempRoutput.split("~"); for(int i = 0; i