[R] Printting 'for' and 'while' indices

Roger D. Peng rpeng at jhsph.edu
Mon Feb 9 21:00:56 CET 2004


Use cat() or print().

-roger

Marcos Sanches wrote:
> Sorry, I forgot to correct the message subject, so I am resending my
> doubt it below:
> 
> 
>  Hi all!
> 
>  I wrote a very basic program in R, which has some loops ('for' and
> 'while').  Is there a way to print the 'for' (or while) indice while the
> program is running so that I am able to estimate where the program is
> and how long it will last?
> 
> I mean, I want something like this:
> 
> i<-0
> While(i<100){
> "do a lot of commands"
> "print i"
> i<-i+1
> }
> 
> How do I "print" the "i" at each step?
> 
> Thanks in advance,
> 
> Marcos
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.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