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

View source: R/progressBar.R

progressBarR Documentation

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

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

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

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. However, when running in a terminal and the width of the terminal windows is smaller than 40 characters, the progress bar will not be displayed.

Value

An object of class "txtProgressBar".

Note

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

See Also

txtProgressBar

Examples

# 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")

pbmcapply documentation built on April 28, 2022, 5:06 p.m.