Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

showConnections: Display Connections

showConnectionsR Documentation

Display Connections

Description

Display aspects of connections.

Usage

showConnections(all = FALSE)getConnection(what)closeAllConnections()stdin()stdout()stderr()nullfile()isatty(con)

Arguments

all

logical: if true all connections, including closed onesand the standard ones are displayed. If false only open user-createdconnections are included.

what

integer: a row number of the table given byshowConnections.

con

a connection.

Details

stdin(),stdout() andstderr() are standardconnections corresponding to input, output and error on the consolerespectively (and not necessarily to file streams). They are text-modeconnections of class"terminal" which cannot be opened orclosed, and are read-only, write-only and write-only respectively.Thestdout() andstderr() connections can bere-directed bysink (and in some circumstances theoutput fromstdout() can be split: see the help page).

The encoding forstdin() when redirected canbe set by the command-line flag--encoding.

nullfile() returns filename of the null device ("/dev/null"on Unix,"nul:" on Windows).

showConnections returns a matrix of information. If aconnection object has been lost or forgotten,getConnectionwill take a row number from the table and return a connection objectfor that connection, which can be used to close the connection,for example. However, if there is noR level object referring to theconnection it will be closed automatically at the next garbagecollection (except forgzcon connections).

closeAllConnections closes (and destroys) all userconnections, restoring allsink diversions as it doesso.

isatty returns true if the connection is one of the class"terminal" connections and it is apparently connected to aterminal, otherwise false. This may not be reliable in embeddedapplications, including GUI consoles.

Value

stdin(),stdout() andstderr() return connectionobjects.

showConnections returns a character matrix of information witha row for each connection, by default only for open non-standard connections.

getConnection returns a connection object, orNULL.

Note

stdin() refers to the ‘console’ and not to the C-level‘stdin’ of the process. The distinction matters in GUI consoles(which may not have an active ‘stdin’, and if they do it may notbe connected to console input), and also in embedded applications.If you want access to the C-level file stream ‘stdin’, usefile("stdin").

WhenR is reading a script from a file, thefile is the‘console’: this is traditional usage to allow in-line data (see‘An Introduction to R’ for an example).

See Also

connections

Examples

showConnections(all = TRUE)## Not run: textConnection(letters)# oops, I forgot to record that oneshowConnections()#  class     description      mode text   isopen   can read can write#3 "letters" "textConnection" "r"  "text" "opened" "yes"    "no"mycon <- getConnection(3)## End(Not run)c(isatty(stdin()), isatty(stdout()), isatty(stderr()))

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