I am looking for a way to store CSV formatted text into a string in JRI (Java/R Interface). Currently, the only way I know for dealing with writing CSV files is:
write.csv(MyData, file = "MyData.csv")
Which formats MyData into CSV and writes it to a CSV file. My application, though, does not use files so I need to set the output of write.csv to a variable instead of a file.
I have tried this code snippet that, according to the documentation, just formats a data.frame to a string.
REXP s = Rutils.rengine.eval("write_csv(foo, sep = ',', quote = TRUE, row.names = FALSE, col.names = FALSE)");
System.out.println(s);
being Rutils the class where I store my Rengine and foo the data frame I try to format (which contains association rules extracted from arules' apriori function.
However, I get null as my output every time I run the file.
Is there any way to do that?