progressBar {time} | R Documentation |
progressBar
is initially called to draw the framework of the progress bar, then called during each iteration to update the number of bars, if needed.
The return value of progressBar
should always be stored, then passed as the prev
argument to the next call to progressBar
.
progressBar(prop = 0, prev = 0)
prop |
Specify the proportion of progress accomplished. |
prev |
The number of bars already drawn, the return value prev obtained from the last call to progressBar . |
The number of bars drawn already, to be passed as the prev
argument to the next call to progressBar
.
The current line of the terminal needs to be empty for progressBar
to be drawn properly. Just make sure the last printed character was an end of line character, "\n"
.
Another assumption that progressBar
makes is that it will be the only thing drawing to the terminal during the duration of calls to it. For proper appearance, no other drawing to the terminal should be done until progressBar
is called with prop >= 1
, which it takes as the signal that the analysis task is complete.
Toby Dylan Hocking <tobob@berkeley.edu>
n <- 5000 prev <- progressBar() for( i in 1:n ) { #TimeConsumingAnalysisTask prev <- progressBar(i/n,prev) }