View source: R/progress_utils.R
| create_progressor | R Documentation |
Creates a progress reporting function for use in loops or apply-style operations. Returns a no-op function if progressr is not available or disabled.
create_progressor(steps, enable = TRUE)
steps |
Integer specifying the total number of steps |
enable |
Logical indicating whether to enable progress reporting (default: TRUE) |
This function wraps progressr::progressor() with a fallback for when progressr
is not available.
A function that signals progress when called. If progressr is not available
or enable = FALSE, returns a no-op function.
progressr::progressor(), with_progress()
## Not run:
# Enable progress reporting
progressr::handlers("progress")
# Use in a loop
p <- create_progressor(10)
results <- lapply(1:10, function(i) {
Sys.sleep(0.1)
p() # Signal progress
i^2
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.