dplyr (version 0.2)

Progress-class: Progress bar with estimated time.

Description

This reference class represents a text progress bar displayed estimated time remaining. When finished, it displays the total duration.

Arguments

Methods

begin()
Initialise timer. Call this before beginning timing.

pause(x)
Sleep for x seconds. Useful for testing.

tick()
Process one element

Details

Progress bar will wait until at least min_time seconds have elapsed before displaying any results.

Examples

Run this code
p <- Progress(3)
p$tick()
p$tick()
p$tick()

p <- Progress(3)
for (i in 1:3) p$pause(0.1)$tick()$show()

p <- Progress(3)
p$tick()$show()$
 pause(1)$stop()

# If min_time is set, progress bar not shown until that many
# seconds have elapsed
p <- Progress(3, min_time = 3)
for (i in 1:3) p$pause(0.1)$tick()$show()

## Not run: ------------------------------------
# p <- Progress(10, min_time = 3)
# for (i in 1:10) p$pause(0.5)$tick()$show()
## ---------------------------------------------

Run the code above in your browser using DataLab