progressBar: Progress bar with the estimated time to completion (ETA).

Description Usage Arguments Details Value Note See Also Examples

View source: R/progressBar.R

Description

This is an extended version of the txtProgressBar function with the estimated time to completion (ETA). Please refer to that for documentation (help(utils::txtProgressBar)). The original utils::setTxtProgressBar can be used to update the bar. Use help(setTxtProgressBar, "utils") to get help about the original function.

Usage

1
2
progressBar(min = 0, max = 1, initial = 0, style = "ETA", substyle = NA,
            char = "=", width = NA, file = "")

Arguments

min, max, initial

see txtProgressBar.

style

style of the progress bar - see 'Details'.

substyle

substyle of the progress bar - only needed when style is set to certain value (see 'Details').

char, width, file

see txtProgressBar.

Details

The progress bar should be closed when finished with: this outputs the final newline character.

When style = "txt", it performs exactly the same as the original txtProgressBar. In this case, substyle shall be treated as the style in the original txtProgressBar. Please refer to the 'Detail' of txtProgressBar for the meanings of substyles.

When style = "ETA", it shows a progress bar with the estimated time to completion (ETA). Substyle is not used in this case.

Value

An object of class "txtProgressBar".

Note

Code derived from library pbarETA (https://github.com/franapoli/pbarETA) by Francesco Napolitano [email protected]@gmail.com.

See Also

txtProgressBar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Test function
testit <- function(x, ...)
{
    pb <- progressBar(...)
    for(i in c(0, x, 1)) {
      setTxtProgressBar(pb, i)
    }
    close(pb)
}

# Txt progress bar
testit(sort(runif(10)), style = "txt", substyle = 3)

# ETA progress bar
testit(sort(runif(10)), style = "ETA")

kvnkuang/pbmcapply documentation built on May 22, 2018, 1:37 a.m.