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.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Doran, Harold
> Sent: Thursday, June 17, 2010 8:33 AM
> To: r-help@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@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.

______________________________________________
R-help@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.

Reply via email to