Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.21.0109262243300.1420-100000@amadeus.statistik.uni-dortmund.de>
Date: 2001-09-26T20:49:20Z
From: Uwe Ligges
Subject: Forcing a refresh in R for Windows
In-Reply-To: <OFDA8F6ADA.3AD701A8-ON85256AD3.0063E22F@bd.com>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._