progressBar | R Documentation |
Generalized progress bars, with 3 default flavours.
progressBar(name = names(progressBars), ...)
# declare a new progress bar
setProgressBarMethod(name, definition)
## S3 method for class 'progressBar'
close(con, ...)
name |
character string, which kind of progress bar to make or set a
method. By default, one of |
... |
Further arguments passed to other methods. |
definition |
a function that will create a progress bar corresponding to
|
con |
progress bar to be closed. |
A "progressBar"
object.
txtProgressBar
tkProgressBar
# if we use 'tryCatch', we can make use 'finally' to guarantee the progress bar
# is closed, regardless of signalling an error or user interupt. not entirely
# useful in this example, but it can be in longer, more complicated situations
tryCatch({
pb <- progressBar(if (.Platform$OS.type == "windows")
"win"
else "txt", max = 20, style = 3)
for (i in 1:20) {
Sys.sleep(0.05)
pb$increment()
}
}, finally = {
close(pb)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.