Wrapper function that executes an expression with optional progress reporting. Integrates with the progressr package when available.
Details
This function provides a consistent interface for progress reporting across riemtan.
Progress handlers can be configured using progressr::handlers().
When enable = TRUE and progressr is installed, users can see progress by calling:
progressr::handlers("progress") # or "txtprogressbar", "cli", etc.Examples
if (FALSE) { # \dontrun{
# Enable progress reporting
progressr::handlers("progress")
# Use within a function
result <- with_progress({
p <- progressr::progressor(steps = 10)
lapply(1:10, function(i) {
Sys.sleep(0.1)
p() # Signal progress
i^2
})
}, name = "Computing squares")
} # }