pbr: Progress bar

Description Usage Arguments Value Examples

View source: R/pbr.R

Description

Create a progress bar object

Usage

1
pbr(iterations = 10, width = NULL, min_width = 10, max_width = 1000L)

Arguments

iterations

Number of total expected iterations

width

Desired width of the progress bar (including text)

min_width

Desired minimum width

max_width

Desired max width

Value

A progress bar list with tick and done functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## define test function with a for loop
pb_test <- function(n = 50, secs = 3) {
  pb <- pbr(n)
  on.exit(pb$done(), add = TRUE)
  for (i in seq_len(n)) {
    Sys.sleep(secs / n)
    pb$tick()
  }
}
## execute test function
pb_test()

mkearney/pbr documentation built on Dec. 21, 2021, 7:05 p.m.