Learn R Programming

progressr (version 0.6.0)

make_progression_handler: Creates a Progression Calling Handler

Description

A progression calling handler is a function that takes a base::condition as its first argument and that can be use together with base::withCallingHandlers(). This function helps creating such progression calling handler functions.

Usage

make_progression_handler(
  name,
  reporter = list(),
  handler = NULL,
  enable = getOption("progressr.enable", Sys.getenv("R_PROGRESSR_ENABLE",
    interactive())),
  enable_after = getOption("progressr.enable_after",
    Sys.getenv("R_PROGRESSR_ENABLE_AFTER", 0)),
  times = getOption("progressr.times", Sys.getenv("R_PROGRESSR_TIMES", +Inf)),
  interval = getOption("progressr.interval", Sys.getenv("R_PROGRESSR_INTERVAL", 0)),
  intrusiveness = 1,
  clear = getOption("progressr.clear", Sys.getenv("R_PROGRESSR_CLEAR", TRUE)),
  target = "terminal",
  ...
)

Arguments

name

(character) Name of progression handler.

reporter

(environment) A reporter environment.

handler

(function) Function take a progression condition as the first argument.

enable

(logical) If FALSE, then progress is not reported.

enable_after

(numeric) Delay (in seconds) before progression updates are reported.

times

(numeric) The maximum number of times this handler should report progression updates. If zero, then progress is not reported.

interval

(numeric) The minimum time (in seconds) between successive progression updates from this handler.

intrusiveness

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

clear

(logical) If TRUE, any output, typically visual, produced by a reporter will be cleared/removed upon completion, if possible.

target

(character vector) Specifies where progression updates are rendered.

Additional arguments passed to make_progression_handler() or not used.

Value

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

Details

The inner details of progression handlers and how to use this function are still to be documented. Until then, see the source code of existing handlers for how it is used, e.g. progressr::handler_txtprogressbar. Please use with care as things might change.

See Also

base::withCallingHandlers().