Warning Messages in Renjin

77 views Asked by At

I am using Renjin to use R code in Java. when I am running R code with syntax: "engine.eval(new java.io.FileReader("Forecast_temp.R"));" where "Forecast_temp.R" is the R code file.

Renjin is showing some messages as given below

Loading required package: stats

Loading required package: graphics

Loading required package: zoo

Loading required package: stats

Loading required package: timeDate

Loading required package: graphics

Loading required package: utils

Loading required package: stats

Loading required package: methods

Loading required package: methods

I want them to hide, how can I do that. any help most welcome please

I am using "forecast", "plyr","lubridate","reshape2" packages for my work

1

There are 1 answers

1
akbertram On BEST ANSWER

You can hide all output from scripts using the javax.script API:

RenjinScriptEngineFactory engineFactory = new 
RenjinScriptEngineFactory();
ScriptEngine engine = engineFactory.getScriptEngine();
engine.getContext().setWriter(CharStreams.nullWriter()); // std out
engine.getContext().setErrorWriter(CharStreams.nullWriter()); // std err
engine.eval("print(1:99)");   // will not appear in process std out