EVOLUTION-MANAGER
Edit File: txtProgressBar.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Text Progress Bar</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for txtProgressBar {utils}"><tr><td>txtProgressBar {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Text Progress Bar</h2> <h3>Description</h3> <p>Text progress bar in the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> console. </p> <h3>Usage</h3> <pre> 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, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>min, max</code></td> <td> <p>(finite) numeric values for the extremes of the progress bar. Must have <code>min < max</code>.</p> </td></tr> <tr valign="top"><td><code>initial, value</code></td> <td> <p>initial or new value for the progress bar. See ‘Details’ for what happens with invalid values.</p> </td></tr> <tr valign="top"><td><code>char</code></td> <td> <p>the character (or character string) to form the progress bar.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>the width of the progress bar, as a multiple of the width of <code>char</code>. If <code>NA</code>, the default, the number of characters is that which fits into <code>getOption("width")</code>.</p> </td></tr> <tr valign="top"><td><code>style</code></td> <td> <p>the ‘style’ of the bar – see ‘Details’.</p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>an open connection object or <code>""</code> which indicates the console: <code><a href="../../base/html/showConnections.html">stderr</a>()</code> might be useful here.</p> </td></tr> <tr valign="top"><td><code>pb, con</code></td> <td> <p>an object of class <code>"txtProgressBar"</code>.</p> </td></tr> <tr valign="top"><td><code>title, label</code></td> <td> <p>ignored, for compatibility with other progress bars.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>for consistency with the generic.</p> </td></tr> </table> <h3>Details</h3> <p><code>txtProgressBar</code> will display a progress bar on the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> console (or a connection) via a text representation. </p> <p><code>setTxtProgessBar</code> will update the value. Missing (<code><a href="../../base/html/NA.html">NA</a></code>) and out-of-range values of <code>value</code> will be (silently) ignored. (Such values of <code>initial</code> cause the progress bar not to be displayed until a valid value is set.) </p> <p>The progress bar should be <code>close</code>d when finished with: this outputs the final newline character. </p> <p><code>style = 1</code> and <code>style = 2</code> just shows a line of <code>char</code>. They differ in that <code>style = 2</code> redraws the line each time, which is useful if other code might be writing to the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> console. <code>style = 3</code> marks the end of the range by <code>|</code> and gives a percentage to the right of the bar. </p> <h3>Value</h3> <p>For <code>txtProgressBar</code> an object of class <code>"txtProgressBar"</code>. </p> <p>For <code>getTxtProgressBar</code> and <code>setTxtProgressBar</code>, a length-one numeric vector giving the previous value (invisibly for <code>setTxtProgressBar</code>). </p> <h3>Note</h3> <p>Using <code>style</code> 2 or 3 or reducing the value with <code>style = 1</code> uses <span class="samp">\r</span> to return to the left margin – the interpretation of carriage return is up to the terminal or console in which <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> is running, and this is liable to produce ugly output on a connection other than a terminal, including when <code>stdout()</code> is redirected to a file. </p> <h3>See Also</h3> <p><code><a href="winProgressBar.html">winProgressBar</a></code> (Windows only), <code><a href="../../tcltk/html/tkProgressBar.html">tkProgressBar</a></code> (Unix-alike platforms). </p> <h3>Examples</h3> <pre> # slow testit <- function(x = sort(runif(20)), ...) { pb <- txtProgressBar(...) for(i in c(0, x, 1)) {Sys.sleep(0.5); setTxtProgressBar(pb, i)} Sys.sleep(1) close(pb) } testit() testit(runif(10)) testit(style = 3) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>