[R] Printing status updates in while-loop
jim holtman
jholtman at gmail.com
Wed Jul 14 20:53:47 CEST 2010
try:
print(counter)
flush.console() # force the output
On Wed, Jul 14, 2010 at 2:31 PM, Michael Haenlein
<haenlein at escpeurope.eu> wrote:
> Dear all,
>
> I'm using a while loop in the context of an iterative optimization
> procedure. Within my while loop I have a counter variable that helps me to
> determine how long the loop has been running. Before the loop I initialize
> it as counter <- 0 and the last condition within my loop is counter <-
> counter + 1.
>
> I'd like to print out the current status of "counter" while the loop is
> running to know where the optimization routine is standing. I tried to do so
> by adding print(counter) within the while loop. This does however not seem
> to work as instead of printing regular updates all print commands are
> executed only after the loop is finished.
>
> Is there some easy way to print regular status updates while the while loop
> is still running?
>
> Thanks,
>
> Michael
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list