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
(no subject)
5 messages · Gilda Garibotti, Peter Dalgaard, Paul Lemmens +2 more
"Gilda Garibotti" <gilda.garibotti at hci.utah.edu> writes:
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.
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.
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
Hoi Peter, --On woensdag 4 juni 2003 0:16 +0200 Peter Dalgaard BSA
<p.dalgaard at biostat.ku.dk> wrote:
"Gilda Garibotti" <gilda.garibotti at hci.utah.edu> writes:
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.
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.
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
Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /"\ Montessorilaan 3 (B.01.03) Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber +31-24-3612648 Fax +31-24-3616066
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:
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
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Wed, 4 Jun 2003, Thomas W Blackwell wrote:
I think cat() will print immediately from inside a loop.
So will print(), but Gilda is probably on Windows and hasn't read the rw-FAQ Q6.3. FAQs are useful things!
On Tue, 3 Jun 2003, Gilda Garibotti wrote:
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.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595