Skip to contents

A progression handler for utils::txtProgressBar().

Usage

handler_txtprogressbar(
  char = "=",
  style = 3L,
  file = stderr(),
  intrusiveness = getOption("progressr.intrusiveness.terminal", 1),
  target = "terminal",
  ...
)

Arguments

char

(character) The symbols to form the progress bar for utils::txtProgressBar(). Contrary to txtProgressBar(), this handler supports also ANSI-colored symbols.

style

(integer) The progress-bar style according to utils::txtProgressBar().

file

(connection) A base::connection to where output should be sent.

intrusiveness

(numeric) A non-negative scalar on how intrusive (disruptive) the reporter to the user.

target

(character vector) Specifies where progression updates are rendered.

...

Additional arguments passed to utils::txtProgressBar() and make_progression_handler().

Value

A function of class progression_handler that takes a progression condition as its first and only argument.

Appearance

Below are a few examples on how to use and customize this progress handler. In all cases, we use handlers(global = TRUE).

library(progressr)
handlers("txtprogressbar")
y <- slow_sum_p(1:25)

Examples

handlers("txtprogressbar")

with_progress({ y <- slow_sum_p(1:10) })
#> M: Added value 1
#> M: Added value 2
#> M: Added value 3
#> M: Added value 4
#> M: Added value 5
#> M: Added value 6
#> M: Added value 7
#> M: Added value 8
#> M: Added value 9
#> M: Added value 10
print(y)
#> [1] 55