Reputation: 9427
I have a java program that produces a String[][], this array is then turned into a csv file. For example my program may output in something like this,
String[][] test = {{name, bc1, bc2, bc3},{name1, 10,20,30},
{name2, 5,15,20},{name3, 6,12,18}}
and the csv (test.csv) file looks like
name bc1 bc2 bc3
name1 10 20 30
name2 5 15 20
name3 6 12 18
Now I could take this csv file and create a R graph, for instance
testR -> read.csv("test.csv")
boxplot(testR)
My question is: Can I run R "within" java and have my java program handle R and perhaps output the R graph as a pdf or another graphical file? Thanks
Upvotes: 1
Views: 2368
Reputation: 103325
Check out the JRI/rJava project which provides a Java/R interface. After you download the package, see the examples directory.
Another option is to use the RCaller library (though I've never tried it myself...this question suggests potential performance issues).
Upvotes: 2