[R] Pretty printing progress
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')
Hope this helps,
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----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')
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help