handler_progress: Progression Handler: Progress Reported via 'progress'...

Description Usage Arguments Requirements Appearance Examples

View source: R/handler_progress.R

Description

A progression handler for progress::progress_bar().

Usage

1
2
3
4
5
6
7
handler_progress(
  format = ":spin [:bar] :percent :message",
  show_after = 0,
  intrusiveness = getOption("progressr.intrusiveness.terminal", 1),
  target = "terminal",
  ...
)

Arguments

format

(character string) The format of the progress bar.

show_after

(numeric) Number of seconds to wait before displaying the progress bar.

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

Requirements

This progression handler requires the progress package.

Appearance

Below is how this progress handler renders by default at 0%, 30% and 99% progress:

With handlers(handler_progress()):

- [-------------------------------------------------]   0% 
\ [====>--------------------------------------------]  10% 
| [================================================>]  99% 

If the progression updates have messages, they will appear like:

- [-----------------------------------------]   0% Starting
\ [===========>----------------------------]  30% Importing
| [=====================================>]  99% Summarizing

Examples

1
2
3
4
5
6
7
if (requireNamespace("progress", quietly = TRUE)) {

  handlers(handler_progress(format = ":spin [:bar] :percent :message"))
  with_progress({ y <- slow_sum(1:10) })
  print(y)
  
}

progressr documentation built on Sept. 24, 2021, 5:07 p.m.