I\'m using a grid engine to run R scripts. The STDERR is taken seriously under this setup, so I would like to keep it clean and have only real/serious/fatal errors printed t
@Dirk already provided the answer, but I would just add that you can use stdout()
to get a connection to the STDOUT. You can use this in any output function to direct output there.
Look at the help page for sink()
:
‘sink’ diverts R output to a connection. If ‘file’ is a character string, a file connection with that name will be established for the duration of the diversion.
Normal R output (to connection ‘stdout’) is diverted by the default ‘type = "output"’. Only prompts and (most) messages continue to appear on the console. Messages sent to ‘stderr()’ (including those from ‘message’, ‘warning’ and ‘stop’) can be diverted by ‘sink(type = "message")’ (see below).