I figured out the problem: functions
gzfile/unz/file/... create a connection to a file but
do not *open* the connection unless the 'open'
argument is specified.
... a little R gotcha for people who use other
programming languages and expect similar
concepts/behavior.
> I get unexpected behavio
I get unexpected behavior from "readLines()" and
"scan()" depending on how the file is opened with
"gzfile" or "unz". More specifically:
> file <- gzfile("file.gz")
> readLines(file,1)
[1] "a\tb\tc"
> readLines(file,1)
[1] "a\tb\tc"
> close(file)
It seems that the stream is rewound between calls
2 matches
Mail list logo