Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

pushBack: Push Text Back on to a Connection

pushBackR Documentation

Push Text Back on to a Connection

Description

Functions to push back text lines onto a connection, and to enquirehow many lines are currently pushed back.

Usage

pushBack(data, connection, newLine = TRUE,         encoding = c("", "bytes", "UTF-8"))pushBackLength(connection)clearPushBack(connection)

Arguments

data

a character vector.

connection

A connection.

newLine

logical. If true, a newline is appended to each stringpushed 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 bethe first string from the last call topushBack. Lines whichare pushed back are read prior to the normal input from theconnection, by the normal text-reading functions such asreadLines andscan.

Pushback is only allowed for readable connections in text mode.

Not all uses of connections respect pushbacks, in particular the inputconnection is still wired directly, so for example parsingcommands from the console andscan("") ignore pushbacks onstdin.

When character strings with a marked encoding (seeEncoding) are pushed back they are converted to thecurrent encoding ifencoding = "". This may involverepresenting characters as<U+xxxx> if they cannot beconverted. They will be converted to UTF-8 ifencoding = "UTF-8" or left as-is ifencoding = "bytes".

Value

pushBack andclearPushBack() return nothing, invisibly.

pushBackLength returns the number of lines currently pushed back.

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)

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp