I am working on a relatively large data analytics project in which an R script I wrote is the primary executable, calling all other bits of code. I can't figure out how to call an executable .jar from my R script, however and I haven't seen this question posted elsewhere... is this a possibility?
Asked
Active
Viewed 4,290 times
2 Answers
8
You can use rJava
to create an instance of your java Object. Then you call its methods ..
library(rJava)
.jinit(PATH_TO_YOUR_JAR) # this starts the JVM
jobject <- .jnew("yourJavaClass") ## call the constructor
.jcall(jobject ,"I",method="YOUR_METHOD") ## call a method

agstudy
- 119,832
- 17
- 199
- 261