EVOLUTION-MANAGER
Edit File: pushBack.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: Push Text Back on to a Connection</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 pushBack {base}"><tr><td>pushBack {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Push Text Back on to a Connection</h2> <h3>Description</h3> <p>Functions to push back text lines onto a <a href="connections.html">connection</a>, and to enquire how many lines are currently pushed back. </p> <h3>Usage</h3> <pre> pushBack(data, connection, newLine = TRUE, encoding = c("", "bytes", "UTF-8")) pushBackLength(connection) clearPushBack(connection) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>data</code></td> <td> <p>a character vector.</p> </td></tr> <tr valign="top"><td><code>connection</code></td> <td> <p>A <a href="connections.html">connection</a>.</p> </td></tr> <tr valign="top"><td><code>newLine</code></td> <td> <p>logical. If true, a newline is appended to each string pushed back.</p> </td></tr> <tr valign="top"><td><code>encoding</code></td> <td> <p>character string, partially matched. See details.</p> </td></tr> </table> <h3>Details</h3> <p>Several character strings can be pushed back on one or more occasions. The occasions form a stack, so the first line to be retrieved will be the first string from the last call to <code>pushBack</code>. Lines which are pushed back are read prior to the normal input from the connection, by the normal text-reading functions such as <code><a href="readLines.html">readLines</a></code> and <code><a href="scan.html">scan</a></code>. </p> <p>Pushback is only allowed for readable connections in text mode. </p> <p>Not all uses of connections respect pushbacks, in particular the input connection is still wired directly, so for example parsing commands from the console and <code><a href="scan.html">scan</a>("")</code> ignore pushbacks on <code><a href="showConnections.html">stdin</a></code>. </p> <p>When character strings with a marked encoding (see <code><a href="Encoding.html">Encoding</a></code>) are pushed back they are converted to the current encoding if <code>encoding = ""</code>. This may involve representing characters as <span class="samp"><U+xxxx></span> if they cannot be converted. They will be converted to UTF-8 if <code>encoding = "UTF-8"</code> or left as-is if <code>encoding = "bytes"</code>. </p> <h3>Value</h3> <p><code>pushBack</code> and <code>clearPushBack()</code> return nothing, invisibly. </p> <p><code>pushBackLength</code> returns the number of lines currently pushed back. </p> <h3>See Also</h3> <p><code><a href="connections.html">connections</a></code>, <code><a href="readLines.html">readLines</a></code>.</p> <h3>Examples</h3> <pre> zz <- textConnection(LETTERS) readLines(zz, 2) pushBack(c("aa", "bb"), zz) pushBackLength(zz) readLines(zz, 1) pushBackLength(zz) readLines(zz, 1) readLines(zz, 1) close(zz) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>