Skip to content

Commit 2f62911

Browse files
spell and grammar corrections [ci skip]
1 parent ac24d2c commit 2f62911

18 files changed

+116
-121
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.18.0-9003
2+
Version: 0.18.0-9004
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",

NEWS.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184

185185
## Significant Changes
186186

187-
* Now `with_progress()` and `without_progress()` disables the global
187+
* Now `with_progress()` and `without_progress()` disable the global
188188
progress handler temporarily while running to avoid progress
189189
updates being handled twice. Previously, it was, technically,
190190
possible to have two different progress handlers intertwined.
@@ -230,7 +230,7 @@
230230

231231
## New Features
232232

233-
* When the using a 'winprogressbar' or a 'tkprogressbar' handler,
233+
* When using a 'winprogressbar' or a 'tkprogressbar' handler,
234234
progression messages updates the `label` component of the progress
235235
panel. Now, it is also possible to update the `title` component
236236
based on progression messages. How the `title` and `label`
@@ -241,7 +241,7 @@
241241
ones to update both. For backward compatible reasons, the default
242242
is `inputs = list(title = NULL, label = "message")`.
243243

244-
* Now the demo function `slow_sum()` outputs also "sticky" messages.
244+
* Now the demo function `slow_sum()` also outputs "sticky" messages.
245245

246246
## Miscellaneous
247247

@@ -252,7 +252,7 @@
252252

253253
## New Features
254254

255-
* Now **plyr** (>= 1.8.7) supports **progressr** for also parallel
255+
* Now **plyr** (>= 1.8.7) supports **progressr** also for parallel
256256
processing, e.g. `y <- plyr::llply(X, slow_sum, .parallel = TRUE,
257257
.progress = "progressr")`.
258258

@@ -276,7 +276,7 @@
276276
## Bug Fixes
277277

278278
* A progressor that signaled progress beyond 100% prevented any
279-
further progressors in the same environment to report on progress.
279+
further progressors in the same environment reporting on progress.
280280

281281
* It was not possible to reuse handlers of type 'progress' more than
282282
once, because they did not fully reset themselves when finished.
@@ -298,7 +298,7 @@
298298
## Performance
299299

300300
* The progressor function created by `progressor()` no longer
301-
"inherit" objects from the calling environment, which would, for
301+
inherits objects from the calling environment, which would, for
302302
instance, result in those objects to be exported to parallel
303303
workers together with the progressor function, which in turn would
304304
come with large time and memory costs.
@@ -322,14 +322,14 @@
322322
the call stack should be recorded in each `progression` condition.
323323

324324
* Now `print()` for `progressor` functions and `progression`
325-
conditions report also on the size of the object, i.e. the number
325+
conditions reports also on the size of the object, i.e. the number
326326
of bytes it requires when serialized, for instance, to and from a
327327
parallel worker.
328328

329329
## Bug Fixes
330330

331331
* Registered progression handlers would report on progress also when
332-
in a _forked_ parallel child processes, e.g. when using
332+
in a _forked_ parallel child process, e.g. when using
333333
`parallel::mclapply()`. This would give a false impression that
334334
**progressr** updates would work when using `parallel::mclapply()`,
335335
which is not true. Note however, that it does indeed work when
@@ -350,11 +350,11 @@
350350
`progressr.*` option. Previously, some of these environment
351351
variables were queried by different functions as a fallback to when
352352
an option was not set. By only parsing them when the package is
353-
loaded, it decrease the overhead in functions, and it clarifies
353+
loaded, it decreases the overhead in functions, and it clarifies
354354
that options can be changed at runtime whereas environment
355355
variables should only be set at startup.
356356

357-
* When using `withProgressShiny()`, progression messages now updates
357+
* When using `withProgressShiny()`, progression messages now update
358358
the `detail` component of the Shiny progress panel. Previously, it
359359
updated the `message` component. This can be configured via new
360360
`inputs` argument.
@@ -379,7 +379,7 @@
379379
* As an alternative to specifying the relative amount of progress,
380380
say, `p(amount = 2)`, it is now possible to also specify the
381381
absolute amount of progress made this far, e.g. `p(step = 42)`.
382-
Argument `amount` has not effect when argument `step` is specified.
382+
Argument `amount` has no effect when argument `step` is specified.
383383
WARNING: Argument `step` should only be used when in full control
384384
of the order when this `progression` condition is signaled. For
385385
example, it must not be signaled as one of many parallel progress
@@ -521,7 +521,7 @@
521521

522522
* Argument `interval` was ignored for `handler_debug()`.
523523

524-
* The class of `handler_<nnn>()` functions where all
524+
* The class of `handler_<nnn>()` functions were all
525525
`reset_progression_handler` rather than
526526
`<nnn>_progression_handler`. The same bug caused the reported
527527
`name` field to be `"reset"` rather than `"<nnn>"`.
@@ -542,7 +542,7 @@
542542

543543
## Significant Changes
544544

545-
* All progression handler function have been renamed from
545+
* All progression handler functions have been renamed from
546546
`<name>_handler()` to `handler_<name>()` to make it easier to use
547547
autocompletion on them.
548548

@@ -603,7 +603,7 @@
603603
* Package could set `.Random.seed` to NULL, instead of removing it,
604604
which in turn would produce a warning on "'.Random.seed' is not an
605605
integer vector but of type 'NULL', so ignored" when the next random
606-
number generated.
606+
number was generated.
607607

608608

609609
# Version 0.1.4 [2019-07-02]
@@ -619,14 +619,14 @@
619619

620620
* Now it is possible to send "I'm still here" progression updates by
621621
setting the progress step to zero, e.g. `progress(amount = 0)`.
622-
This type of information can for instance be used to updated a
622+
This type of information can for instance be used to update a
623623
progress bar spinner.
624624

625625
* Add utility function `handlers()` for controlling option
626626
`progressr.handlers`.
627627

628628
* Progression handlers' internal state now has a sticky `message`
629-
field, which hold the most recent, non-empty progression `message`
629+
field, which holds the most recent, non-empty progression `message`
630630
received.
631631

632632

@@ -739,7 +739,7 @@
739739

740740
* Now `with_progress(..., cleanup = TRUE)` will signal a generic
741741
"shutdown" progression at the end that will trigger all progression
742-
handlers to finish up regardless of all steps have been take or
742+
handlers to finish up regardless of whether all steps have been taken or
743743
not.
744744

745745
* Now progressions originating from an unknown source are ignored.
@@ -822,7 +822,7 @@
822822
also signal "done" as soon as the last step has been reached.
823823

824824
* Made `amount` the first argument of progressors to avoid having to
825-
specify it by name if progressing with an amount than the default
825+
specify it by name if progressing with an amount other than the default
826826
`amount = 1.0`.
827827

828828
* Add argument `clear` to control whether progress reporter should
@@ -882,4 +882,4 @@
882882

883883
* Add `progress()` to create and signal `progression` condition.
884884

885-
* Add `progression()` to create `progression` condition.
885+
* Add `progression()` to create `progression` condition.

R/handler_cli.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ handler_cli <- function(show_after = 0.0, intrusiveness = getOption("progressr.i
7373
}
7474

7575
cli_progress_bar <- function(total, ...) {
76-
## WORKAROUND: Do no not involve 'cli' when total = 0
76+
## WORKAROUND: Do not involve 'cli' when total = 0
7777
if (total == 0) return(NA_character_)
7878

7979
## Make sure to always use the built-in 'cli' handler, no matter
@@ -85,13 +85,13 @@ handler_cli <- function(show_after = 0.0, intrusiveness = getOption("progressr.i
8585
}
8686

8787
cli_progress_update <- function(id, ..., force = TRUE, .envir) {
88-
## WORKAROUND: Do no not involve 'cli' when total = 0
88+
## WORKAROUND: Do not involve 'cli' when total = 0
8989
if (.envir$total == 0) return(id)
9090
cli_progress_call(cli::cli_progress_update, id = id, ..., force = force, .envir = .envir)
9191
}
9292

9393
cli_progress_done <- function(id, ..., .envir) {
94-
## WORKAROUND: Do no not involve 'cli' when total = 0
94+
## WORKAROUND: Do not involve 'cli' when total = 0
9595
if (.envir$total == 0) return(id)
9696
cli_progress_call(cli::cli_progress_done, id = id, ..., .envir = .envir)
9797
}

R/handlers.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
#' Control How Progress is Reported
22
#'
33
#' @param \ldots One or more progression handlers. Alternatively, this
4-
#' functions accepts also a single vector of progression handlers as input.
4+
#' function also accepts a single vector of progression handlers as input.
55
#' If this vector is empty, then an empty set of progression handlers will
66
#' be set.
77
#'
88
#' @param append (logical) If FALSE, the specified progression handlers
9-
#' replace the current ones, otherwise appended to them.
9+
#' replace the current ones, otherwise they are appended to them.
1010
#'
1111
#' @param on_missing (character) If `"error"`, an error is thrown if one of
12-
#' the progression handlers does not exists. If `"warning"`, a warning
13-
#' is produces and the missing handlers is ignored. If `"ignore"`, the
14-
#' missing handlers is ignored.
12+
#' the progression handlers does not exist. If `"warning"`, a warning
13+
#' is produced and the missing handler is ignored. If `"ignore"`, the
14+
#' missing handler is ignored.
1515
#'
1616
#' @param default The default progression calling handler to use if none
1717
#' are set.
1818
#'
1919
#' @param global If TRUE, then the global progression handler is enabled.
2020
#' If FALSE, it is disabled. If NA, then TRUE is returned if it is enabled,
21-
#' otherwise FALSE. Argument `global` must not used with other arguments.
21+
#' otherwise FALSE. Argument `global` must not be used with other arguments.
2222
#'
2323
#' @return (invisibly) the previous list of progression handlers set.
2424
#' If no arguments are specified, then the current set of progression
2525
#' handlers is returned.
2626
#' If `global` is specified, then TRUE is returned if the global progression
27-
#' handlers is enabled, otherwise false.
27+
#' handler is enabled, otherwise FALSE.
2828
#'
2929
#' @details
3030
#' This function provides a convenient alternative for getting and setting
3131
#' option \option{progressr.handlers}.
3232
#'
3333
#' @section For package developers:
3434
#' **IMPORTANT: Setting progression handlers is a privilege that should be
35-
#' left to the end user. It should not be used by R packages, which only task
35+
#' left to the end user. It should not be used by R packages, whose only task
3636
#' is to _signal_ progress updates, not to decide if, when, and how progress
3737
#' should be reported.**
3838
#'
3939
#' If you have to set or modify the progression handlers inside a function,
4040
#' please make sure to undo the settings afterward. If not, you will break
4141
#' whatever progression settings the user already has for other purposes
42-
#' used elsewhere. To undo you settings, you can do:
42+
#' used elsewhere. To undo your settings, you can do:
4343
#'
4444
#' ```r
4545
#' old_handlers <- handlers(c("beepr", "progress"))
@@ -53,8 +53,7 @@
5353
#' R session to use global progression handler by default, and (ii) report
5454
#' progress via the \pkg{progress} package when in the terminal and via the
5555
#' RStudio Jobs progress bar when in the RStudio Console.
56-
#' [handler_txtprogressbar],
57-
#' other whenever using the RStudio Console, add
56+
#' To configure this, add
5857
#' the following to your \file{~/.Rprofile} startup file:
5958
#'
6059
#' ```r

R/progressor.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @param along (vector; alternative) Alternative that sets
88
#' `steps = length(along)`.
99
#'
10-
#' @param offset,scale (integer; optional) scale and offset applying transform
10+
#' @param offset,scale (integer; optional) scale and offset applying the transform
1111
#' `steps <- scale * steps + offset`.
1212
#'
1313
#' @param transform (function; optional) A function that takes the effective
@@ -42,7 +42,7 @@
4242
#' @details
4343
#' A `progressor` function can only be created inside a local environment,
4444
#' e.g. inside a function, within a `local()` call, or within a
45-
#' `with_progress()` call. Notably, it _cannot_ be create at the top level,
45+
#' `with_progress()` call. Notably, it _cannot_ be created at the top level,
4646
#' e.g. immediately at the R prompt or outside a local environment in an
4747
#' R script. If attempted, an informative error message is produced, e.g.
4848
#'
@@ -120,7 +120,7 @@ progressor <- local({
120120
formals(fcn)$message <- message
121121
class(fcn) <- c("progressor", class(fcn))
122122

123-
## WORKAROUND: Use teeny, custom enviroment for the progressor function.
123+
## WORKAROUND: Use teeny, custom environment for the progressor function.
124124
## The default would otherwise be to inherit the parent frame, which
125125
## might contain very large objects.
126126
progressor_envir <- new.env(parent = getNamespace(.packageName))
@@ -132,7 +132,7 @@ progressor <- local({
132132
}
133133
environment(fcn) <- progressor_envir
134134

135-
## Is there already be an active '...progressr'?
135+
## Is there already an active '...progressr'?
136136
## If so, make sure it is finished and then remove it
137137
if (exists("...progressor", mode = "function", envir = envir)) {
138138
...progressor <- get("...progressor", mode = "function", envir = envir)

R/with_progress.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#' If NULL or an empty list, progress updates are ignored.
77
#'
88
#' @param cleanup If TRUE, all progression handlers will be shutdown
9-
#' at the end regardless of the progression is complete or not.
9+
#' at the end regardless of whether the progression is complete or not.
1010
#'
1111
#' @param delay_terminal If TRUE, output and conditions that may end up in
12-
#' the terminal will delayed.
12+
#' the terminal will be delayed.
1313
#'
1414
#' @param delay_stdout If TRUE, standard output is captured and relayed
1515
#' at the end just before any captured conditions are relayed.
@@ -19,8 +19,8 @@
1919
#' standard output is relayed.
2020
#'
2121
#' @param interrupts Controls whether interrupts should be detected or not.
22-
#' If TRUE and a interrupt is signaled, progress handlers are asked to
23-
#' report on the current amount progress when the evaluation was terminated
22+
#' If TRUE and an interrupt is signaled, progress handlers are asked to
23+
#' report on the current amount of progress when the evaluation was terminated
2424
#' by the interrupt, e.g. when a user pressed Ctrl-C in an interactive session,
2525
#' or a batch process was interrupted because it ran out of time.
2626
#' Note that it's optional for a progress handler to support this and only
@@ -50,19 +50,19 @@
5050
#' handlers.
5151
#'
5252
#' **IMPORTANT: This function is meant for end users only. It should not
53-
#' be used by R packages, which only task is to _signal_ progress updates,
53+
#' be used by R packages, whose only task is to _signal_ progress updates,
5454
#' not to decide if, when, and how progress should be reported.**
5555
#'
5656
#' @section Progression handler functions:
5757
#' Formally, progression handlers are calling handlers that are called
5858
#' when a [progression] condition is signaled. These handlers are functions
59-
#' that takes one argument which is the [progression] condition.
59+
#' that take one argument which is the [progression] condition.
6060
#'
6161
#' @section Progress updates in batch mode:
6262
#' When running R from the command line, R runs in a non-interactive mode
6363
#' (`interactive()` returns `FALSE`). The default behavior of
6464
#' `with_progress()` is to _not_ report on progress in non-interactive mode.
65-
#' To have progress being reported on also then, set R options
65+
#' To have progress being reported also then, set R options
6666
#' \option{progressr.enable} or environment variable \env{R_PROGRESSR_ENABLE}
6767
#' to `TRUE`. Alternatively, one can set argument `enable=TRUE` when calling
6868
#' `with_progress()`. For example,

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ developer. How these progress updates are rendered is controlled by
1414
the end user. For instance, some users may prefer visual feedback
1515
such as a horizontal progress bar in the terminal, whereas others may
1616
prefer auditory feedback. The **[progressr]** framework is designed
17-
to work out-of-the-box also with parallel and distributed processing,
17+
to work out-of-the-box also for parallel and distributed processing,
1818
especially with the **[futureverse]** ecosystem.
1919

2020
<img src="vignettes/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
@@ -147,7 +147,7 @@ by:
147147
> progressr::handlers(global = TRUE)
148148
```
149149

150-
After this, progress will be reported;
150+
After this, progress will be reported:
151151

152152
```r
153153
> y <- slow_sum(1:10)
@@ -177,18 +177,18 @@ notification systems. You can also use a mix of these, e.g.
177177
handlers(c("cli", "beepr", "ntfy"))
178178
```
179179

180-
See the 'Customizing How Progress is Reported' vignette for for examples.
180+
See the 'Customizing How Progress is Reported' vignette for examples.
181181

182182

183183
## Additional Features
184184

185185
### Support for progressr elsewhere
186186

187-
Note that progression updates by **progressr** is designed to work out
187+
Note that progression updates by **progressr** are designed to work out
188188
of the box for any iterator framework in R. See the different package
189189
vignettes for details. Prominent examples are:
190190

191-
* `lapply()` etc. of base R
191+
* `lapply()` etc. in base R
192192
* `map()` etc. by the **[purrr]** package
193193
* `llply()` etc. by the **[plyr]** package
194194
* `foreach()` iterations by the **[foreach]** package
@@ -212,7 +212,7 @@ Other uses of **progressr** are:
212212
### Use regular output as usual alongside progress updates
213213

214214
In contrast to other progress-bar frameworks, output from `message()`,
215-
`cat()`, `print()` and so on, will _not_ interfere with progress
215+
`cat()`, `print()` and so on will _not_ interfere with progress
216216
reported via **progressr**. For example, say we have:
217217

218218
```r
@@ -320,7 +320,6 @@ Step 10
320320
[pbmcapply]: https://cran.r-project.org/package=pbmcapply
321321
[plyr]: https://cran.r-project.org/package=plyr
322322
[BiocParallel]: https://www.bioconductor.org/packages/BiocParallel/
323-
324323
## Installation
325324
R package progressr is available on [CRAN](https://cran.r-project.org/package=progressr) and can be installed in R as:
326325
```r

0 commit comments

Comments
 (0)