[R] "displayed" output of cat(..., stderr()) is garbaged

About this list Date view Thread view Subject view Author view Attachment view

From: Vadim Ogranovich (vograno@arbitrade.com)
Date: Sat 15 Jun 2002 - 11:47:36 EST


Message-id: <AFD78192EC49D311BFAE00902798AB8F23D9D1@JUPITER>

Dear R-users,

To display progress of a loop I wanted to print the current value of the
loop variable, e.g.

> for (i in 1:2) cat("i=", i, "\n")
for (i in 1:2) cat(i, "\n")
i= 1
i= 2

So far so good. Now I want to redirect it to stderr() (to make it
unbuffered)

> for (i in 1:2) cat("i=", i, "\n", stderr())
for (i in 1:2) cat("i=", i, "\n", stderr())
i= 1
 2i= 2
 2>

This is contaminated with the value of the stderr file descriptor (2).

Is there any way to get rid of this "garbage"? Is there any other way to
write to stderr?

Thanks, Vadim

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:26 EST