[R] cat function within a loop

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Oct 5 17:03:40 CEST 2004


Tatsuki Koyama wrote:

> I have a 'cat' function within a for loop.
> I would like it to print out the result everytime it goes through the
> for loop so that I can monitor the progress, but it only prints out
> (execute the cat function) once at the very end of the for loop.
> A simple example:
> 
> for(i in 1:100000){
> 	cat(i, '\n')
> }
> 
> What should I do in order for the cat function to be executed
> everytime it goes thorough the for loop?

This is a FAQ mentioned in the R for Windows FAQ!
Please read it before posting (and do not forget to mention on which OS 
you are working with which version of R).

Uwe Ligges


> Thanks!
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list