Learn R Programming

progressr (version 0.7.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"))

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

Run this code
# NOT RUN {
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)
}

# }
# NOT RUN {
handlers(global = FALSE)
# }

Run the code above in your browser using DataLab