Re: [R] unexpected behavior from gzfile and unz

2007-12-19 Thread Matthew Suderman
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

[R] unexpected behavior from gzfile and unz

2007-12-19 Thread Matthew Suderman
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