여러 개의 탭 delim 파일을 자바를 통해 R에 넘겨 준다. R programm는 그 탭 delim 파일을 하나의 파일로 병합하고 java로 되돌려 보내며 변수 "name"에 캡처된다. windows.Any 도움이 매우 appreciated.Here 대화 상자에서 저장하여 탭 DELIM으로 "이름"에 저장된 파일의 이름을 변경하고 저장하고자하는 자바 코드 :R에서 Java로 파일을 넘겨 준다
import org.rosuda.REngine.*;
public class rjava {
// Before this run Rserve() command in R
public String ana(String filenames)
{
String name = "";
try{
System.out.println("INFO: Trying to connect to R ");
RConnection c = new RConnection();
System.out.println("INFO: Connected to R");
System.out.println("INFO: The Server version is "+ c.getServerVersion());
// c.voidEval("source('D:/combine/combining_files.r')");
c.voidEval("source('D:/combine/merge.r')");
c.assign("file",filenames);
// name = (c.eval("fn(file)").asString());
name = (c.eval("combine (file)").asString());
c.close();
}
catch(Exception e)
{
System.out.println("ERROR: In Connection to R");
System.out.println("The Exception is "+ e.getMessage());
e.printStackTrace();
}
return name;
}
}
어떻게 * 정확한 * 자바에서 R을 호출하고 있습니까? –
rosuda REngine을 사용하여 R을 호출했습니다. – Dinesh
여기에 무엇이 요청되는지 확실하지 않습니다. 당신이 알아낼 수없는 것은 무엇입니까? 그 한 가지를 어떻게 풀려고 했습니까? 예제 코드를 공유 할 수 있습니까? –