I have an R script that retrieves data from a database, performs some operations on it and provides me with data I want to retrive in Java using JRI
beforeQuery <- c(1)
query <- {{Query}}
....
queryResult <- fetch(queryResultSet,1)
The Java code that gets the result:
re.eval("source('" + location + "')"); //location of the R script
System.out.println(re.eval("beforeQuery").asString()); //works
System.out.println(re.eval("queryResult$column").asString()); //returns null
I have verified that queryResult is okay by running the R program standalone.
What can I do to make sure that I can get the result inside the java program successfully?