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? Thanks, Jim Garrett Becton Dickinson Diagnostic Systems Baltimore, Maryland, USA -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Jim_Garrett at bd.com writes:> 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?flush.console(), I believe. (Not sitting at a Windows box, though) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._