Package 'progressify'

Title: Progress Reporting of Common Functions via One Magic Function
Description: The progressify() function rewrites (transpiles) calls to sequential and parallel map-reduce functions such as base::lapply(), purrr::map(), foreach::foreach(), and plyr::llply() to signal progress updates. By combining this function with R's native pipe operator, you have a straightforward way to report progress on iterative computations with minimal refactoring, e.g. 'lapply(x, fcn) |> progressify()' and 'purrr::map(x, fcn) |> progressify()'. It is compatible with the parallel-processing map-reduce packages 'future.apply', 'furrr', 'crossmap', 'foreach', 'doFuture', and 'futurize'. It also supports domain-specific packages including 'boot', 'fwb', 'lme4', 'partykit', 'sandwich', and 'SimDesign', e.g. 'boot::boot(data, stat, R) |> progressify()'.
Authors: Henrik Bengtsson [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-7579-5165>)
Maintainer: Henrik Bengtsson <[email protected]>
License: Apache License (>= 2)
Version: 0.2.0-9020
Built: 2026-10-11 11:58:20 UTC
Source: https://github.com/futureverse/progressify

Help Index


Evaluate a regular map-reduce call with progress updates

Description

Evaluate a regular map-reduce call with progress updates

Usage

progressify(
  expr,
  substitute = TRUE,
  ...,
  when = TRUE,
  eval = TRUE,
  envir = parent.frame()
)

Arguments

expr

An R expression.

substitute

If TRUE, expr is quoted.

when

If TRUE (default), the expression is progressified, otherwise not.

eval

If TRUE (default), the progressified expression is evaluated, otherwise it is returned.

envir

The environment in which expr is evaluated.

...

Not used.

Value

Returns the value of the evaluated expression expr.

Expression unwrapping

The transpilation mechanism includes logic to "unwrap" expressions enclosed in constructs such as !, { }, ⁠( )⁠, local(), I(), identity(), invisible(), suppressMessages(), suppressWarnings(), suppressPackageStartupMessages(), withCallingHandlers(), and with(). The transpiler descends through wrapping constructs until it finds a transpilable expression, avoiding the need to place progressify() inside such constructs. This allows for patterns like:

y <- {
  lapply(xs, fcn)
} |> suppressMessages() |> progressify()

avoiding having to write:

y <- {
  lapply(xs, fcn) |> progressify()
} |> suppressMessages()

Examples

handlers(global = TRUE) # listen to progress updates

xs <- list(1, 1:2, 1:2, 1:5)
y <- lapply(X = xs, FUN = sum) |> progressify()
str(y)

List packages and functions supporting progressification

Description

List packages and functions supporting progressification

Usage

progressify_supported_packages()

progressify_supported_functions(package)

Arguments

package

A package name.

Value

A character vector of package or function names.

Examples

pkgs <- progressify_supported_packages()
pkgs

fcns <- progressify_supported_functions("base")
print(fcns)

if (requireNamespace("purrr")) {
  fcns <- progressify_supported_functions("purrr")
  print(fcns)
}