Learn R Programming

progressr (version 0.17.0)

register_global_progression_handler: Add or Remove a Global 'progression' Handler

Description

Add or Remove a Global 'progression' Handler

Usage

register_global_progression_handler(action = c("add", "remove", "query"))

Value

Returns TRUE if a handler is registered, otherwise FALSE. If action = "query", the value is visible, otherwise invisible.

Arguments

action

(character string) If "add", a global handler is added. If "remove", it is removed, if it exists. If "query", checks whether a handler is registered or not.

Requirements

This function requires R (>= 4.0.0) - the version in which global calling handlers where introduces.

Examples

Run this code
if (getRversion() >= "4.0.0" && !is.element("pkgdown", loadedNamespaces()))
handlers(global = TRUE)

## This renders progress updates for each of the three calls slow_sum()
for (ii in 1:3) {
  xs <- seq_len(ii + 3)
  message(sprintf("%d. slow_sum()", ii))
  y <- slow_sum(xs, stdout = TRUE, message = TRUE)
  print(y)
}

if (getRversion() >= "4.0.0" && !is.element("pkgdown", loadedNamespaces()))
handlers(global = FALSE)

Run the code above in your browser using DataLab