Looking for an options which let me to redirect R diagnostic messages (produces by message()
) to stdout
, not stderr
as it is by defaul
Using sink
. Here's a modification of your code:
sink(stdout(), type = "message") # sink messages to stdout
print("using print")
cat("using cat\n")
message("using message")
warning("using warning")
sink(NULL, type="message") # close the sink
warning("after ending sink") # this will be the only thing in your err file
q("no")