[R] Pretty printing progress

Greg Snow Greg.Snow at imail.org
Thu Jun 17 20:20:59 CEST 2010


Others mentioned progress bars and sprintf, one other option is to use a named vector and let R to the formatting:

> tmp <- c(10, -1234) # or variables to put the values in
> names(tmp) <- c('Iteration', '     Log Likelihood')
> print(tmp)

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Doran, Harold
> Sent: Thursday, June 17, 2010 8:33 AM
> To: r-help at r-project.org
> Subject: [R] Pretty printing progress
> 
> I have a function that is an iterative process for estimating some
> MLEs. I want to print some progress to screen as the process iterates.
> I would like to try and line things up nicely in the R window, but am
> not sure the best way to do this. Below is a toy example. Suppose I
> want the value of 10 to be just below "iteration" and the value of -
> 1234 to be just below 'Log Likelihood'.
> 
> I cannot seem to get these to line up nicely on screen as a progress
> indicator. Any recommendations?
> 
> 
> cat('Iteration', '\t', 'Log Likelihood', '\n', 10, '\t', -1234, '\n')
> 
> Harold
> 
> 	[[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.



More information about the R-help mailing list