[R] readLines() changes mode of connection

Vadim Ogranovich vograno at arbitrade.com
Mon Dec 2 01:47:03 CET 2002


Hi,

It seems like reading a line from a gzfile() connection changes the mode of
the connection from text to binary (it also alters "can write", in case it
matters). The following transcript, produced on RedHat 7.1, demonstrates
this "feature" (note the evolution of file$text). Is this expected?

Thanks, Vadim


> file <- gzfile("foo.gz")
file <- gzfile("foo.gz")
> summary(file)
summary(file)
$description
[1] "foo.gz"

$class
[1] "gzfile"

$mode
[1] "rb6"

$text
[1] "text"

$opened
[1] "closed"

$"can read"
[1] "yes"

$"can write"
[1] "yes"

> hdr <- readLines(file, 1)
hdr <- readLines(file, 1)
> summary(file)
summary(file)
$description
[1] "foo.gz"

$class
[1] "gzfile"

$mode
[1] "rb6"

$text
[1] "binary"

$opened
[1] "closed"

$"can read"
[1] "yes"

$"can write"
[1] "no"



-------------------------------------------------- 
DISCLAIMER 
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof. 

E-mail transmission cannot be guaranteed to be secure or error-free.  The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.

NOTICE regarding privacy and confidentiality 

Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications. 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list