handlers: Control How Progress is Reported

Description Usage Arguments Details Value Examples

View source: R/handlers.R

Description

Control How Progress is Reported

Usage

1
2
3
4
5
6
handlers(
  ...,
  append = FALSE,
  on_missing = c("error", "warning", "ignore"),
  default = handler_txtprogressbar
)

Arguments

...

One or more progression handlers. Alternatively, this functions accepts also a single vector of progression handlers as input. If this vector is empty, then an empty set of progression handlers will be set.

append

(logical) If FALSE, the specified progression handlers replace the current ones, otherwise appended to them.

on_missing

(character) If "error", an error is thrown if one of the progression handlers does not exists. If "warning", a warning is produces and the missing handlers is ignored. If "ignore", the missing handlers is ignored.

default

The default progression calling handler to use if none are set.

Details

This function provides a convenient alternative for getting and setting option progressr.handlers.

IMPORTANT: Setting progression handlers is a privileges that should be left to the end user. It should not be used by R packages, which only task is to signal progress updates, not to decide if, when, and how progress should be reported.

Value

(invisibly) the previous list of progression handlers set. If no arguments are specified, then the current set of progression handlers is returned.

Examples

1
2
3
4
5
6
handlers("txtprogressbar")
if (requireNamespace("beepr", quietly = TRUE))
  handlers("beepr", append = TRUE)

with_progress({ y <- slow_sum(10) })
print(y)

progressr documentation built on March 26, 2020, 6:05 p.m.