java – How can I add an R script on my web application?
I am trying to run an R script on my web application. The script runs perfectly on R studio. I am using the Renjin package.
This is what i am trying to run
private void scriptREval() throws Exception {
RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
ScriptEngine engine = factory.getScriptEngine();
try {
engine.eval("library(openxlsx)");
engine.eval("library(deSolve)");
engine.eval("file<- filename");
// Load data from the Excel file
engine.eval("SB.K <- as.matrix(read.xlsx(file, colNames = FALSE, namedRegion = 'K'))");
engine.eval("SB.m0 <- read.xlsx(file, colNames = FALSE, namedRegion = 'm0')");
} catch (ScriptException e) {
e.printStackTrace();
}
}
these are the dependencies I am using
org.renjin
renjin-script-engine
0.9.2726
org.renjin.cran
openxlsx
4.1.0.1-b1
org.renjin.cran
deSolve
1.23-b1
However there is a problem with the openxlsx library thus I cannot perform further calculations.
org.renjin.eval.EvalException: object ‘C_unzip’ not found
Any help please?
Read more here: Source link
