futureverse / futureverse/progressr

add_progress({ ... ])

Open
#29 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
R
Stars
299
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Example:
```r
with_progress(add_progress({
x <- 1:100
y <- slow_sum(x)
z <- slow_sum(x^2)
mu <- mean(z - y^2)
}), clear = FALSE)
```
could produce progress output that looks something like:
```r
[==>---------] 25%: x <- 1:100
[=====>------] 50%: y <- slow_sum(x)
[========>---] 75%: z <- slow_sum(x^2)
[============] 100%: mu <- mean(z - y^2)
```
or "cleverly" truncated, e.g.
```r
[==>---------] 25%: x <- 1:1...
[=====>------] 50%: y <- slo...
[========>---] 75%: z <- slo...
[============] 100%: mu <- me...
```

BTW, we could also have a "step" progress reporter;
```r
1/4: x <- 1:100
2/4: y <- slow_sum(x)
3/4: z <- slow_sum(x^2)
4/4: mu <- mean(z - y^2)
```
or just
```r
1: x <- 1:100
2: y <- slow_sum(x)
3: z <- slow_sum(x^2)
4: mu <- mean(z - y^2)
```

BTW2, we might want to show what expression is currently being evaluated, e.g.
```r
[>-----------] 0%: x <- 1:100 ...
[===>--------] 25%: y <- slow_sum(x) ...
[======>-----] 50%: z <- slow_sum(x^2) ...
[========>---] 75%: mu <- mean(z - y^2) ...
[============] 100%: DONE
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.