如何在java变量中存储R数据帧

如何在java变量中存储R数据帧,java,r,Java,R,我在R中有一个函数,它返回不同数据类型的数据帧 我正在从java调用R函数 但我不知道如何调用将返回数据帧的R函数 我使用下面的代码返回字符串数组。 如何处理数据帧 String[] output_f1= c.eval("fun1(x)").asStrings(); package java_r_dataframe; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import

我在R中有一个函数,它返回不同数据类型的数据帧

我正在从java调用R函数

但我不知道如何调用将返回数据帧的R函数

我使用下面的代码返回字符串数组。 如何处理数据帧

String[] output_f1= c.eval("fun1(x)").asStrings();
package java_r_dataframe;

import java.io.BufferedWriter;
import java.io.File;
 import java.io.FileWriter;
 import org.rosuda.REngine.REXP;
 import org.rosuda.REngine.REXPGenericVector;
import org.rosuda.REngine.REXPMismatchException;
import org.rosuda.REngine.RList;
import org.rosuda.REngine.Rserve.RConnection;
 import org.rosuda.REngine.Rserve.RserveException;

 public class mymainclass {

 public static void main(String[] args) throws RserveException,   REXPMismatchException {

RConnection c = new RConnection();

c.eval("source(\"/home/Jayshree/Desktop/return_data2.R\")");
 RList a  = c.eval("return_dataframe_2()").asList();


 REXPGenericVector v = new REXPGenericVector(a);

 c.eval("source(\"/home/Jayshree/Desktop/return_data2.R\")");
 c.assign("x", v);
  String b = c.eval("return_dataframe_3(x)").asString();

  System.out.println(b);
  }}