[R] cat() to STDERR
P.Dalgaard at biostat.ku.dk
Fri Apr 20 17:06:50 CEST 2007
ivo welch wrote:
> Dear R wizards---I read Brian Ripley's post from 2004 which said that
> it was not possible to print to STDERR. Alas, I have more modest
> needs. I was wondering if it was possible to just send a string to
> STDERR with cat() while in CMD BATCH mode.
> Is it not possible to open STDERR in R? (Or does R use STDERR for
> itself and redirect it into the output stream?)
> This would be on a standard Unix (gentoo) system and R 2.4.x.
$ echo 'sink(stderr());cat("Goodbye, cruel World!\n");sink()' | R -q
--vanilla 2> tictactoe
> sink(stderr());cat("Goodbye, cruel World!\n");sink()
$ cat tictactoe
Goodbye, cruel World!
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help