Learn R Programming

ursa (version 3.8.8)

ursaProgressBar: Progress bar

Description

Informative progress bars with dispaying elapsed and remained time.

Usage

ursaProgressBar(kind = c("tk", "txt"),title = .argv0(),
                label = "", min = 0, max = 1, initial = min, width = NA, style = 1)

setUrsaProgressBar(pb, value, title = NULL, label = NULL)

Arguments

kind

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".

style

See description for the same argument in txtProgressBar.

width

See description for the same argument in tkProgressBar.

title, label, min, max, initial, value, pb, …

See description for the same arguments in tkProgressBar and txtProgressBar.

Value

ursaProgressBar returns object of reference progress bar.

Details

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.

See Also

txtProgressBar tkProgressBar

Examples

Run this code
# NOT RUN {
session_grid(NULL)
n1 <- 3
n2 <- 83
p <- 0.0011
#require(tcltk)
pb <- ursaProgressBar(min=0,max=n1,title="first")
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