JBuildProgressBar | R Documentation |
This function attempts to guess the total elapsed time based on time so far
and numItems
.
JBuildProgressBar(
progressBar = c("text", "win", "tk", "none"),
numItems,
title = NULL,
showPC = FALSE
)
progressBar |
Type of progress bar. |
numItems |
Number of items to be processed. |
title |
Optional message displayed on the progress bar. |
showPC |
If |
The progress bar can be displayed as a Windows popup, a TCL popup, text
printed to the console, or no progress bar depending on the value of
progressBar
.
The function (fn
) returned by this function is usually called with no
arguments, once for each item to be processed. Call fn(close = TRUE)
to close the progress bar without processing all items. If the number of
items to be processed changes dynamically, call fn(numNumItems = x)
.
A function which should be called for each item as it is processed.
## Not run:
n <- 20
pb <- JBuildProgressBar("win", numItems = n, title = "Progress")
for (i in 1:n) {
# Execute slow task
Sys.sleep(runif(1, max = 1))
# Update progress bar
pb()
}
# Optionally force close in case there weren't as many items as we expected
pb(close = TRUE)
# Optionally report total elapsed time
pb(printElapsed = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.