Informative progress bars with dispaying elapsed and remained time.
ursaProgressBar(kind = c("tk", "txt"),title = .argv0(),
label = "", min = 0, max = 1, initial = min, width = NA,
style = 1, tail = FALSE, silent = FALSE)setUrsaProgressBar(pb, value, title = NULL, label = NULL)
# S3 method for ursaProgressBar
close(con, ...)
ursaProgressBar
returns object of reference progress bar.
Character. Type or progress bar. Valid values are "tk"
to display progress bar in tcl/tk window and "txt"
to display progress bar in terminal mode. Default is "tk"
.
See description for the same argument in txtProgressBar
.
See description for the same argument in tkProgressBar
.
See description for the same arguments in tkProgressBar
and txtProgressBar
.
See description for the same arguments in close
.
Logical. Behaviour of progress bar appearing. If TRUE
then progress bar will be used after progress step (e.g., at the end of routine). Default is FALSE
(before progress step).
Logical. If TRUE
then progress bar will not appeared; it can be useful for conditional scripting. Default is FALSE
.
Nikita Platonov platonov@sevin.ru
Wrapper to one of
txtProgressBar
,
tkProgressBar
.
Visualization of progress bar is updates each 0.5 seconds, it is effective for multiple short-term iterations.
Progress bars should be closed by calling of appropriate method of generic function close
depending of class of reference progress bar.
session_grid(NULL)
n1 <- 3
n2 <- 83
p <- 0.0011
#require(tcltk)
pb <- ursaProgressBar(min=0,max=n1,title="first",tail=TRUE)
for (i in seq(n1)) {
pb2 <- ursaProgressBar(min=0,max=n2,title="second")
for (i in seq(n2)) {
setUrsaProgressBar(pb2)
Sys.sleep(p)
}
close(pb2)
setUrsaProgressBar(pb)
}
close(pb)
Run the code above in your browser using DataLab