[R] Progress in a loop
Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress of the loop during the process. I tried to include something like print(paste(k,date(),sep= : )) where k is the number of the iteration, but the result appears only at the end of the loop. Can someone help me please ? ___ Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! __ R-help@stat.math.ethz.ch 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.
Re: [R] Progress in a loop
Florent Bresson wrote: Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress of the loop during the process. I tried to include something like print(paste(k,date(),sep= : )) where k is the number of the iteration, but the result appears only at the end of the loop. Can someone help me please ? Please read the R for Windows FAQ: When using Rgui the output to the console seems to be delayed. Uwe Ligges ___ Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.
Re: [R] Progress in a loop
Look for progress() in the svMisc package -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Florent Bresson Sent: Wednesday, July 19, 2006 10:13 AM To: r-help@stat.math.ethz.ch Subject: [R] Progress in a loop Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress of the loop during the process. I tried to include something like print(paste(k,date(),sep= : )) where k is the number of the iteration, but the result appears only at the end of the loop. Can someone help me please ? __ _ Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.
Re: [R] Progress in a loop
On Wed, 2006-07-19 at 16:12 +0200, Florent Bresson wrote: Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress of the loop during the process. I tried to include something like print(paste(k,date(),sep= : )) where k is the number of the iteration, but the result appears only at the end of the loop. Can someone help me please ? Windows I assume - you are asked to provide some rudimentary information about your system when asking for help as the posting guide states. You need to use flush.console() on Windows, as in: dat - matrix(runif(20), ncol = 2) res - numeric(length = 10) for(i in 1:10) { res[i] - sum(dat[i, ]) cat(paste(Iteration #:, i, -, date(), \n)) flush.console() } Depending on how you want the printed statements to appear on the screen, you'd be better off with cat not print, e.g.: cat(paste(k,date(),sep= : )) If this isn't the solution, post a reply containing information about your R version, OS, and a reproducible example (simple code data as I did) to show us the problem. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch 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.