r-lib / progress

Progress bar in your R terminal
http://r-lib.github.io/progress/
Other
468 stars 39 forks source link

More convenient use of progress in for loops #90

Closed moodymudskipper closed 1 year ago

moodymudskipper commented 5 years ago

I played around with this question on SO.

My solution that I packaged there wraps around progress and allows one to use either of the following syntaxes :

pb_for()
for (i in 1:10) {
  # DO SOMETHING
}

pb <- progress_bar$new(format = "Something: [:bar] :percent :elapsed")
pb  -> for (i in 1:10) {
  # DO SOMETHING
}

It uses some quirks of the R language but it offers an intuitive interface and avoids the current issue of having to type "2 things".

You can find more by following either link above. The code might be too weird for this package but if you think it might have a place here it's yours to take and tweak.

gaborcsardi commented 1 year ago

In a similar spirit, see this in cli: https://cli.r-lib.org/reference/cli_progress_along.html

We are focusing on cli now, so I am going to close this issue.