Re: [R] Show Progress in loop

From: <vincent_at_7d4.com>
Date: Mon 10 Oct 2005 - 19:25:51 EST

Rainer M. Krug a écrit :

> Hi
> I have a loop which is doing time consuming calculations and I would
> like to be able to have some feedback on where it is in it's
> calculations. I tried to simply show the counter variable in the loop,
> but id doesn't work as all display seems to be delayed until the loop is
> completed. Is there any way of displaying the progress of a loop?
>
> for (i in 2:Result$NoSims)
> {
> ...
> i #<========================Doesn't display in the loop
> }
>

Hi,
for your last line, use :

print(i);
flush.console(); #<====== now displays in the loop

hih



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 Received on Mon Oct 10 19:48:10 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:36:25 EST