Text progress bar in the R console.
txtProgressBar(min = 0, max = 1, initial = 0, char = "=", width = NA, title, label, style = 1, file = "") getTxtProgressBar(pb) setTxtProgressBar(pb, value, title = NULL, label = NULL) ## S3 method for class 'txtProgressBar': close((con, ...))
- min, max
- (finite) numeric values for the extremes of the progress bar. Must have
min < max.
- initial, value
- initial or new value for the progress bar. See ‘Details’ for what happens with invalid values.
- the character (or character string) to form the progress bar.
- the width of the progress bar, as a multiple of the width of
NA, the default, the number of characters is that which fits into
- the ‘style’ of the bar -- see ‘Details’.
- an open connection object or
""which indicates the console:
stderr()might be useful here.
- pb, con
- an object of class
- title, label
- ignored, for compatibility with other progress bars.
- for consistency with the generic.
txtProgressBar will display a progress bar on the R console (or a connection) via a text representation.
setTxtProgessBar will update the value. Missing (
NA) and out-of-range values of
value will be (silently) ignored. (Such values of
initial cause the progress bar not to be displayed until a valid value is set.)
The progress bar should be
closed when finished with: this outputs the final newline character.
style = 1 and
style = 2 just shows a line of
char. They differ in that
style = 2 redraws the line each time, which is useful if other code might be writing to the R console.
style = 3 marks the end of the range by
| and gives a percentage to the right of the bar.
txtProgressBar an object of class
style 2 or 3 or reducing the value with
style = 1 uses \r to return to the left margin -- the interpretation of carriage return is up to the terminal or console in which R is running, and this is liable to produce ugly output on a connection other than a terminal, including when
stdout() is redirected to a file.
Documentation reproduced from R 3.0.2. License: GPL-2.