Академический Документы
Профессиональный Документы
Культура Документы
html
Description
Functions to push back text lines onto a connection, and to enquire how many lines are currently
pushed back.
Usage
Arguments
data
a character vector.
connection
A connection.
newLine
logical. If true, a newline is appended to each string pushed back.
encoding
character string, partially matched. See details.
Details
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 pushBack. Lines
which are pushed back are read prior to the normal input from the connection, by the normal text-
reading functions such as readLines and scan.
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 scan("") ignore pushbacks on
stdin.
When character strings with a marked encoding (see Encoding) are pushed back they are
converted to the current encoding if encoding = "". This may involve representing characters as
<U+xxxx> if they cannot be converted. They will be converted to UTF-8 if encoding = "UTF-8"
or left as-is if encoding = "bytes".
Value
1 of 2 18/Sep/2017, 11:03 PM
R: Push Text Back on to a Connection http://127.0.0.1:28599/library/base/html/pushBack.html
See Also
connections, readLines.
Examples
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)
2 of 2 18/Sep/2017, 11:03 PM