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]]


