Skip to content

Commit 35dfd2d

Browse files
Add length() for progressor objects [#188]
1 parent 99f55a6 commit 35dfd2d

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: progressr
2-
Version: 0.17.0-9002
2+
Version: 0.17.0-9003
33
Title: An Inclusive, Unifying API for Progress Updates
44
Description: A minimal, unifying API for scripts and packages to report progress updates from anywhere including when using parallel processing. The package is designed such that the developer can to focus on what progress should be reported on without having to worry about how to present it. The end user has full control of how, where, and when to render these progress updates, e.g. in the terminal using utils::txtProgressBar(), cli::cli_progress_bar(), in a graphical user interface using utils::winProgressBar(), tcltk::tkProgressBar() or shiny::withProgress(), via the speakers using beepr::beep(), or on a file system via the size of a file. Anyone can add additional, customized, progression handlers. The 'progressr' package uses R's condition framework for signaling progress updated. Because of this, progress can be reported from almost anywhere in R, e.g. from classical for and while loops, from map-reduce API:s like the lapply() family of functions, 'purrr', 'plyr', and 'foreach'. It will also work with parallel processing via the 'future' framework, e.g. future.apply::future_lapply(), furrr::future_map(), and 'foreach' with 'doFuture'. The package is compatible with Shiny applications.
55
Authors@R: c(person("Henrik", "Bengtsson",

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
S3method(conditionMessage,progression)
4+
S3method(length,progressor)
45
S3method(print,progression)
56
S3method(print,progression_handler)
67
S3method(print,progressor)

NEWS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# Version (development version)
22

3+
## New Features
4+
5+
* Add `length()` for `progressor` objects, which enables using
6+
`seq_along()` and `seq()` on progressors.
7+
38
## Bug Fixes
49

510
* It was not possible to create more than one progressor in a
611
`with_progress()` call, resulting in additional progressors being
7-
ignored and warnings on "with_progress() received a progression
8-
'initiate' request" being produced.
12+
ignored. Also, warnings on "with_progress() received a progression
13+
'initiate' request" were produced with **progressr** 0.17.0
14+
(2025-10-15).
915

1016

1117
# Version 0.17.0 [2025-10-15]

R/progressor.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ print.progressor <- function(x, ...) {
211211
}
212212

213213

214+
#' @export
215+
length.progressor <- function(x) {
216+
environment(x)[["steps"]]
217+
}
218+
219+
214220
progressr_in_globalenv <- local({
215221
state <- FALSE
216222

0 commit comments

Comments
 (0)