[R] How to stop buffering of "cat"

Greg Snow Greg.Snow at imail.org
Thu May 1 19:49:46 CEST 2008


In addition to what others have pointed to regaurding buffering and cat,
there are also a couple of new functions in R 2.7.0 that help with
showing the progress of computations.  They are winProgressBar (windows
only) and TkProgressBar (in the tcltk package).  You can use these to
create and update a progress bar showing how far along you are.  They
also have options for labels and titles that you can use to show
specific messages (or just percent finished).  I prefer these to cat
statements because you can make the window go away and don't have the
messages from cat cluttering your output.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Vidhu Choudhary
> Sent: Wednesday, April 30, 2008 1:36 PM
> To: r-help at r-project.org
> Subject: [R] How to stop buffering of "cat"
> 
> Hi All,
> My R code takes very long time to finish the processing. I 
> want to see at what stage the script is running. So I wrote 
> some output messages using cat.
> But instead of displaying the cat messages at different 
> stages they are buffered and displayed in the end when entire 
> processing is done.
> Can you please suggest how to stop this buffering or some 
> alternative way to display messages
> 
> Thank you
> Vidhu
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list