register_global_progression_handler: Add or Remove a Global 'progression' Handler

View source: R/global_progression_handler.R

register_global_progression_handlerR Documentation

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"))

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.

Value

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

Requirements

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

Examples


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)
}


handlers(global = FALSE)

HenrikBengtsson/progressr documentation built on Jan. 26, 2024, 12:18 p.m.