Re: [R] How to print output during for loops?

From: Rau, Roland <Rau_at_demogr.mpg.de>
Date: Mon 31 Oct 2005 - 04:25:38 EST


Hi,

 > -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Martin Lam
>
> I was wondering, if it is possible to print out the
> values of variables while you are in a for/while loop?
> Like this for example:
>
> for (i in 1:5) {
> i
> }
>

yes, should be possible:
for (i in 1:5) {

        print(i)
}

It might also help (assuming you work on MS Windows using RGui.exe) to disable "buffered output" by pressing "CTRL+W". As you can see when clicking on "Misc" in the toolbar, the default setting is "buffered output".

I hope this helps,
Roland

+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}



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 31 04:32:08 2005

This archive was generated by hypermail 2.1.8 : Mon 31 Oct 2005 - 09:18:29 EST