[R] how to display the clock time in the loop

Matt Shotwell shotwelm at musc.edu
Thu Jul 1 22:30:59 CEST 2010


Try to flush output after printing:

cat(paste(Sys.time()),"\n"); flush(stdout())

On Thu, 2010-07-01 at 16:17 -0400, Jack Luo wrote:
> Hi,
> 
> I am doing some computation which is pretty time consuming, I want R to
> display CPU time after each iteration using the command Sys.time(). However,
> I found that the code only began to display the CPU time after quite a while
> and several iterations have finished. Is there a way to ask R to display
> time right after each iteration is finished?
> 
> Thanks,
> 
> -Jun
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
Matthew S. Shotwell
Graduate Student
Division of Biostatistics and Epidemiology
Medical University of South Carolina
http://biostatmatt.com



More information about the R-help mailing list