How do you print to stderr
in R
?
This would especially useful for scripts written in Rscript
.
How do you print to stderr
in R
?
This would especially useful for scripts written in Rscript
.
Is it possible to configure the print function to print to stderr?
No, but where standard output goes is controlled by sink(), so you can achieve the same effect. R internally has no idea what output comes from print() (which is not just one function but hundreds of methods).
Actually the following works for me:
write("prints to stderr", stderr())
write("prints to stdout", stdout())