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:
RCaller
is usingjava.util.logging.Logger
, so you need to add alogback.xml - file
for disabling the output of thelogger
.tryCatch({})
insideR
so that yourR code
won't break -> won't trigger any errors inJava
.I would recommend the second solution.
update:
you have to add an
error - block
And if you want to ignore all the
warnings
, wrape yourmethod call
insuppressWarnings(<method-call>)
Or you can also add an
warning - block
to thetryCatch - block