winProgressBar

0th

Percentile

Progress Bars under MS Windows

Put up a Windows progress bar widget, update and access it.

Keywords
utilities
Usage
winProgressBar(title = "R progress bar", label = "",
               min = 0, max = 1, initial = 0, width = 300)

getWinProgressBar(pb) setWinProgressBar(pb, value, title = NULL, label = NULL) # S3 method for winProgressBar close(con, …)

Arguments
title, label

character strings, giving the window title and the label on the dialog box respectively.

min, max

(finite) numeric values for the extremes of the progress bar.

initial, value

initial or new value for the progress bar.

width

the width of the progress bar in pixels: the dialog box will be 40 pixels wider (plus frame).

pb, con

an object of class "winProgressBar".

for consistency with the generic.

Details

winProgressBar will display a progress bar centred on the screen. Space will be allocated for the label only if it is non-empty.

setWinProgessBar will update the value and for non-NULL values, the title and label (provided there was one when the widget was created). Missing (NA) and out-of-range values of value will be (silently) ignored.

The progress bar should be closed when finished with, but it will be garbage-collected once no R object refers to it.

Value

For winProgressBar an object of class "winProgressBar".

For getWinProgressBar and setWinProgressBar, a length-one numeric vector giving the previous value (invisibly for setWinProgressBar).

Note

These functions are only available on Windows.

See Also

On all platforms, txtProgressBar, tkProgressBar

Aliases
  • winProgressBar
  • getWinProgressBar
  • setWinProgressBar
  • close.winProgressBar
Examples
library(utils) # NOT RUN { <!-- % popups are irritating --> pb <- winProgressBar("test progress bar", "Some information in %", 0, 100, 50) Sys.sleep(0.5) u <- c(0, sort(runif(20, 0, 100)), 100) for(i in u) { Sys.sleep(0.1) info <- sprintf("%d%% done", round(i)) setWinProgressBar(pb, i, sprintf("test (%s)", info), info) } Sys.sleep(5) close(pb) # }
Documentation reproduced from package utils, version 3.6.1, License: Part of R 3.6.1

Community examples

leetuga@gmail.com at Nov 7, 2017 utils v3.4.1

total <- 20 pb <- winProgressBar(title = "progress bar", min = 0, max = total, width = 300) for(i in 1:total){ Sys.sleep(0.1) setWinProgressBar(pb, i, title=paste( round(i/total*100, 0), "% done")) } close(pb)