progressBar | R Documentation |
This is an extended version of the txtProgressBar
function with the estimated time to completion (ETA). Please refer to that for documentation (help(utils::txtProgressBar)
).
The original utils::setTxtProgressBar
can be used to update the bar.
Use help(setTxtProgressBar, "utils")
to get help about the original function.
progressBar(min = 0, max = 1, initial = 0, style = "ETA", substyle = NA, char = "=", width = NA, file = "")
min, max, initial |
see |
style |
style of the progress bar - see 'Details'. |
substyle |
substyle of the progress bar - only needed when style is set to certain value (see 'Details'). |
char, width, file |
see |
When style = "txt", it performs exactly the same as the original txtProgressBar
. In this case, substyle shall be treated as the style in the original txtProgressBar
. Please refer to the 'Detail' of txtProgressBar
for the meanings of substyles.
When style = "ETA", it shows a progress bar with the estimated time to completion (ETA). Substyle is not used in this case. However, when running in a terminal and the width of the terminal windows is smaller than 40 characters, the progress bar will not be displayed.
An object of class "txtProgressBar".
Code derived from library pbarETA
(https://github.com/franapoli/pbarETA) by Francesco Napolitano franapoli@gmail.com.
txtProgressBar
# Test function testit <- function(x, ...) { pb <- progressBar(...) for(i in c(0, x, 1)) { setTxtProgressBar(pb, i) } close(pb) } # Txt progress bar testit(sort(runif(10)), style = "txt", substyle = 3) # ETA progress bar testit(sort(runif(10)), style = "ETA")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.