[R] Forcing a refresh in R for Windows

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Sep 26 22:49:20 CEST 2001


On Wed, 26 Sep 2001 Jim_Garrett at bd.com wrote:

> 
> System:  Windows NT 4.0 450 MHz Pentium II, R version 1.3.0 (will upgrade
> soon).
> 
> Is there some way to force the command-line interface to print information
> to the screen before evaluating the next expression?  For example, if I put
> the following in a file:
> 
> cat("Select a file\n")
> filename <- file.choose()
> 
> and source the file, I don't see the instruction "Select a file" until
> after I'm done with the dialog box that pops up.
> 
> Another example involves getting updates from an iterative procedure before
> the procedure is done:
> 
> for(i in 1:500)
> {
> #  if(i %% 10 == 0)
>     cat("iteration ", i, "\n")
>   # <something time-consuming here>
> }
> 
> I don't get any update printed to the screen until after the loop is
> completed, which is when I no longer need it.  If something causes the
> screen to refresh, such as swapping to another application and back, the
> information is printed.  However, is there any kind of programming command
> I can use that will force a printout when I want it?

See section 6.3 in the R-win FAQs.

 flush.console()

Uwe Ligges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list