progressBar: Progress bar

ursaProgressBarR Documentation

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, tail = FALSE, silent = FALSE)

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

## S3 method for class 'ursaProgressBar'
close(con, ...)

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.

con, ...

See description for the same arguments in close.

tail

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

silent

Logical. If TRUE then progress bar will not appeared; it can be useful for conditional scripting. Default is FALSE.

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.

Value

ursaProgressBar returns object of reference progress bar.

Note

Function name in style camelCase for consistence with other progress bar functions in R.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

txtProgressBar tkProgressBar

Examples

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)

nplatonov/ursa documentation built on May 8, 2024, 6:02 p.m.