progress_estimated: Progress bar with estimated time.

Description Usage Arguments Value Examples

View source: R/progress.R

Description

This reference class represents a text progress bar displayed estimated time remaining. When finished, it displays the total duration. The automatic progress bar can be disabled by setting option dplyr.show_progress to FALSE.

Usage

1
progress_estimated(n, min_time = 0)

Arguments

n

Total number of items

min_time

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

Value

A ref class with methods tick(), print(), pause(), and stop().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
p <- progress_estimated(3)
p$tick()
p$tick()
p$tick()

p <- progress_estimated(3)
for (i in 1:3) p$pause(0.1)$tick()$print()

p <- progress_estimated(3)
p$tick()$print()$
 pause(1)$stop()

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

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

## End(Not run)

Example output

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

dplyr documentation built on Sept. 29, 2017, 1:03 a.m.