Anurag Sharma Anurag Sharma - 1 year ago 62
R Question

Warning Messages in Renjin

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

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download