Skip to content
Prev 3834 / 15075 Next

flushing of stdout

On Wed, Aug 22, 2007 at 02:52:55PM -0400, Simon Urbanek wrote:
yeah,  sorry for being inprecise: I'm actually using R frequently
in a terminal/xterm. 

in the R GUI console flush.console() (as also proposed by kevin
middleton: many thanks) actually achieves the desired flushing (without
it: same thing)

so the problem persists in the terminal/xterm. try, e.g.,


for (i in 1:10) {
   for (j in 1:20000) log(j)
   cat(i, " ")
   flush(stdout())
}
cat("\n")


to see the effect. this only occurs if the first `cat' does not contain a
newline (I use this in situations with a large outer loop count to inform the
user how much the simulation run has progressed and it's simply nicer without
too many newlines). 

the behaviour was definitely different in older versions of R.


regards,

joerg