[R] seek(..., origin='current') doesn't work on gzfile

About this list Date view Thread view Subject view Author view Attachment view

From: Vadim Ogranovich (vograno@evafunds.com)
Date: Tue 04 May 2004 - 04:20:20 EST


Message-id: <C698D707214E6F4AB39AB7096C3DE5A54B32DC@phost015.intermedia.net>

HI,
 
It seems that seek(..., origin='current') doesn't properly work on
gzfile connections, while it does work properly on ordinary files.
 
# open a connection and repeatedly increment current position by 13
chars. Note that the read position does not move
> con <- gzfile("foo.gz"); open(con)
> seek(con, 13, origin='current')
[1] 0
> seek(con, 13, origin='current')
[1] 13
> seek(con, 13, origin='current')
[1] 13
> seek(con, 13, origin='current')
[1] 13
 
 
# and the same thing on ordinary file works as expected (and as
documented)
> close(con); con <- file("foo"); open(con)
> seek(con, 13, origin='current')
[1] 0
> seek(con, 13, origin='current')
[1] 13
> seek(con, 13, origin='current')
[1] 26
> seek(con, 13, origin='current')
[1] 39

 
This is R-1.8.1 on RH-7.3
 
Thanks,
Vadim
 
 
P.S. For the sake of completeness this the 'foo' file:
 
A;20030110;P
B;20030110;P
B;20030110;P
B;20030110;T
B;20030110;T
B;20030110;T
B;20030110;T
B;20030110;T
B;20030110;T
C;20030110;T

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST