0

I am running a long R script on a cluster that is started from a bash job script with the 'Rscript' command. In my R script I set options(warn=1). Nevertheless the warnings do not get printed to my logfile as they occur. Instead I get a message There were 50 or more warnings (use warnings() to see the first 50) at the end of execution (i.e., behaviour that I would expect from options(warn=0)). However, options("warn") confirms that the setting is set to 1 during execution.

I have searched for this kind of problem, but not found a solution anywhere. In this similar question, the warn options that I am already setting did the trick. And the solution provided here does not work for me either because there are many different occasions where potential warnings might be raised, both in the script and in functions that are getting called. I have also tried to call warnings() at several locations of my script, but I believe that the command can only access the warnings after the script has finished.

Any ideas what I could do either in my R script or in the bash job script (maybe as an argument to 'Rscript') to print the warning messages to my logfile as they are getting raised?

fmherla
  • 23
  • 5

0 Answers0