Skip to content

(no subject)

5 messages · Gilda Garibotti, Peter Dalgaard, Paul Lemmens +2 more

#
Hi,
I would like to know if it is possible to get printed output while a loop is taking place.
Example:
for(i in 1:10){
 print(i)
 some long process
}

This will print the values of i only after the loop is finished, what I would like is to 
see them when the process enters the i-th iteration to keep track of how the 
program is running.

Thank you,
Gilda
#
"Gilda Garibotti" <gilda.garibotti at hci.utah.edu> writes:
Windows, right? (This is system dependent) There's a menu item
entitled "Buffer output" or something to that effect. Turn it off and
print() calls display immediately. Lengthy output becomes slower,
though.
#
Hoi Peter,

--On woensdag 4 juni 2003 0:16 +0200 Peter Dalgaard BSA
<p.dalgaard at biostat.ku.dk> wrote:

            
If you don't want to depend on you (or other people) turning of the 
buffering, use something like

cat("this or that"); flush.console.


regards,
Paul
#
I think cat() will print immediately from inside a loop.

-  tom blackwell  -  u mihigan medical school  -  ann arbor  -
On Tue, 3 Jun 2003, Gilda Garibotti wrote:

            
#
On Wed, 4 Jun 2003, Thomas W Blackwell wrote:

            
So will print(), but Gilda is probably on Windows and hasn't read the
rw-FAQ Q6.3.

FAQs are useful things!