| Version: | 0.1.0 |
| 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 'futurize' package for parallelization, e.g. 'lapply(x, fcn) |> progressify() |> futurize()' and 'purrr::map(x, fcn) |> futurize() |> progressify()'. |
| License: | GPL (≥ 3) |
| Depends: | R (≥ 4.1.0), progressr |
| Imports: | methods |
| Suggests: | base64enc, commonmark, crossmap, doFuture, foreach, furrr, future.apply, futurize, partykit, plyr, purrr, tools |
| VignetteBuilder: | progressify |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2026-04-02 08:05:19 UTC; hb |
| Author: | Henrik Bengtsson [aut, cre, cph] |
| Maintainer: | Henrik Bengtsson <henrikb@braju.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-07 08:00:08 UTC |
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, |
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 |
... |
Not used. |
Value
Returns the value of the evaluated expression expr.
Examples
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)
}
Transpile an R expression
Description
Transpile an R expression
Usage
transpile(
expr,
options = list(...),
...,
when = TRUE,
eval = TRUE,
envir = parent.frame(),
disable = FALSE,
type = "built-in",
what = "transpile",
unwrap = list(base::`{`, base::`(`, base::`!`, base::local, base::with, base::I,
base::identity, base::invisible, base::suppressMessages, base::suppressWarnings,
base::suppressPackageStartupMessages),
debug = FALSE
)
Arguments
expr |
An R expression, typically a function call to transpile. If FALSE, then the transpiler is disabled, and if TRUE, it is re-enabled. If NA, then TRUE is returned if the transpiler is enabled, otherwise FALSE. |
options |
(optional) Named options for the transpilation. |
when |
If TRUE (default), the expression is transpiled, otherwise not. |
eval |
If TRUE (default), the transpiled expression is evaluated, otherwise it is returned. |
envir |
The environment where the expression should be evaluated. |
type |
Type of the transpiler to use. |
unwrap |
(optional) A list of functions that should be considered
wrapping functions that the transpiler should unwrap ("enter"). This
allows us to transpile expressions within |
Value
Returns the value of the evaluated expression expr if eval = TRUE,
otherwise the transpiled expression.
If expr is NA, then TRUE is returned if the transpiler is enabled,
otherwise FALSE.