Skip to content

Commit a44bb01

Browse files
cleanup
1 parent 83e2229 commit a44bb01

23 files changed

+92
-103
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ Suggests:
1818
progress,
1919
foreach,
2020
purrr,
21-
future (>= 1.15.1),
21+
future (>= 1.16.0),
2222
doFuture,
2323
future.apply,
2424
furrr,
2525
shiny,
2626
notifier
2727
Remotes:
28-
gaborcsardi/notifier@d92b1b6
28+
gaborcsardi/notifier@62d484
2929
URL: https://github.com/HenrikBengtsson/progressr
3030
BugReports: https://github.com/HenrikBengtsson/progressr/issues
3131
RoxygenNote: 7.0.2

OVERVIEW.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Design motto:
1212

1313
## Two Minimal APIs
1414

15-
| Developer's API | End-user's API |
16-
|-----------------------|-----------------------------|
17-
| `p <- progressor(n)` | `with_progress(expr)` |
18-
| `p(msg, ...)` | `handlers(...)` |
19-
| | `options(progressr.*=...)` |
15+
| Developer's API | End-user's API |
16+
|-------------------------------|-----------------------------|
17+
| `p <- progressor(n)` | `with_progress(expr)` |
18+
| `p <- progressor(along = x)` | `handlers(...)` |
19+
| `p(msg, ...)` | `options(progressr.*=...)` |
2020

2121

2222

@@ -26,12 +26,12 @@ Assume that we have a function `slow_sum()` for adding up the values in a vector
2626

2727
```r
2828
slow_sum <- function(x) {
29-
progress <- progressr::progressor(along = x)
29+
p <- progressr::progressor(along = x)
3030
sum <- 0
3131
for (kk in seq_along(x)) {
3232
Sys.sleep(0.1)
3333
sum <- sum + x[kk]
34-
progress(message = sprintf("Added %g", x[kk]))
34+
p(message = sprintf("Added %g", x[kk]))
3535
}
3636
sum
3737
}

R/options.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#' @section Options for progressr examples and demos:
5858
#'
5959
#' \describe{
60-
#' \item{\option{progressr.delay}:}{(numeric) Delay (in seconds) between each iteration of [slow_sum()]. (Default: `1.0`)}
60+
#' \item{\option{progressr.demo.delay}:}{(numeric) Delay (in seconds) between each iteration of [slow_sum()]. (Default: `1.0`)}
6161
#' }
6262
#'
6363
#'
@@ -67,7 +67,7 @@
6767
#' @aliases
6868
#' progressr.clear
6969
#' progressr.debug
70-
#' progressr.delay
70+
#' progressr.demo.delay
7171
#' progressr.delay_stdout progressr.delay_conditions
7272
#' progressr.enable progressr.enable_after
7373
#' progressr.interval
File renamed without changes.

R/progressor.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Create a Progressor Function
1+
#' Create a Progressor Function which Signals Progress Updates
22
#'
33
#' @param steps (integer) Number of progressing steps.
44
#'
@@ -15,7 +15,7 @@
1515
#' @param label (character) A label.
1616
#'
1717
#' @param initiate (logical) If TRUE, the progressor will signal a
18-
#' [progression] 'initiate' condition.
18+
#' [progression] 'initiate' condition when created.
1919
#'
2020
#' @param auto_finish (logical) If TRUE, then the progressor will signal a
2121
#' [progression] 'finish' condition as soon as the last step has been reached.

R/slow_sum.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' This function signals [progression] conditions as it progresses.
1616
#'
1717
#' @export
18-
slow_sum <- function(x, delay = getOption("progressr.delay", 1.0), stdout = FALSE, message = TRUE) {
18+
slow_sum <- function(x, delay = getOption("progressr.demo.delay", 1.0), stdout = FALSE, message = TRUE) {
1919
progress <- progressor(along = x)
2020

2121
sum <- 0

R/with_progress.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#'
2525
#' @example incl/with_progress.R
2626
#'
27-
#' @details
27+
#' @section Progression handler functions:
2828
#' Formally, progression handlers are calling handlers that are called
2929
#' when a [progression] condition is signaled. These handlers are functions
3030
#' that takes one argument which is the [progression] condition.

R/without_progress.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#' Evaluate Expression while Ignoring All Progress Updates
2-
#'
3-
#' @param expr An \R expression to evaluate.
4-
#'
5-
#' @return Return nothing (reserved for future usage).
1+
#' @details
2+
#' `without_progress()` evaluates an expression while ignoring all
3+
#' progress updates.
64
#'
5+
#' @rdname with_progress
76
#' @export
87
without_progress <- function(expr) {
98
withCallingHandlers(expr, progression = function(p) {

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.onLoad <- function(libname, pkgname) {
22
if (in_r_cmd_check()) {
3-
options(progressr.delay = 0.01)
3+
options(progressr.demo.delay = 0.01)
44
}
55
}

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Design motto:
1414

1515
## Two Minimal APIs
1616

17-
| Developer's API | End-user's API |
18-
|-----------------------|-----------------------------|
19-
| `p <- progressor(n)` | `with_progress(expr)` |
20-
| `p(msg, ...)` | `handlers(...)` |
21-
| | `options(progressr.*=...)` |
17+
| Developer's API | End-user's API |
18+
|-------------------------------|-----------------------------|
19+
| `p <- progressor(n)` | `with_progress(expr)` |
20+
| `p <- progressor(along = x)` | `handlers(...)` |
21+
| `p(msg, ...)` | `options(progressr.*=...)` |
2222

2323

2424

@@ -28,12 +28,12 @@ Assume that we have a function `slow_sum()` for adding up the values in a vector
2828

2929
```r
3030
slow_sum <- function(x) {
31-
progress <- progressr::progressor(along = x)
31+
p <- progressr::progressor(along = x)
3232
sum <- 0
3333
for (kk in seq_along(x)) {
3434
Sys.sleep(0.1)
3535
sum <- sum + x[kk]
36-
progress(message = sprintf("Added %g", x[kk]))
36+
p(message = sprintf("Added %g", x[kk]))
3737
}
3838
sum
3939
}

0 commit comments

Comments
 (0)