I'm using RCaller to execute some analysis on a data frame within my Java application. More specifically, I want to run Coarsened Exact Matching using the CEM library of R.
As far as CEM is concerned, it returns some data about the mathching, if any match is found. Otherwise (no match found) it fails.
When I call the runAndReturnResult method from my Java application, if CEM fails inside R, RCaller automatically prints on my Java application's console, all the code that I added to my RCode instance.
Is there a way for preventing this printing? I mean, I want to ignore the cases in which no match is found and move forward, without printing messages on my console.
Thanks in advance to anyone that can help.
There are two ways to handle this:
RCalleris usingjava.util.logging.Logger, so you need to add alogback.xml - filefor disabling the output of thelogger.tryCatch({})insideRso that yourR codewon't break -> won't trigger any errors inJava.I would recommend the second solution.
update:
you have to add an
error - blockAnd if you want to ignore all the
warnings, wrape yourmethod callinsuppressWarnings(<method-call>)Or you can also add an
warning - blockto thetryCatch - block