[R] Using lib Rstreams and gzfile()

Sven Garbade garbade at psy.uni-muenchen.de
Tue Dec 11 11:30:00 CET 2001


Hi all,

in the last time I've intensively used Rstreams to read and write from
binary files. Now I'm wondering if it is possible to use Rsteams
functions with gzipped files. But I haven't found the trick:

> p1c.gzip <- gzfile("daten/p1c_all.mea.gz", open="rb")
> readBin(p1c.gzip, integer(), n=64,size=2)
 [1]    84     1   400     1   749     0     0     0     0     0    
0     0
[13]     0     0     0     0     0     0     0     0     0     0    
0     0
[25]     0     0     0     0     0     0     0     0 11884 25888 25977
11552
[37] 22560     0     0     0     0     0     0     0     0     0    
0     0
[49]     0     0     0     0     0     0     0     0     0     0    
0     0
[61]     0     0     0     0

this is ok, but then with readint from Rstreams:

> seek(p1c.gzip, 0, "start")
[1] 128
> readint(p1c.gzip, 64,2)
 [1] -25620 -17287  21838 -16137  -8489   3835  13806 -28067 -30452
-24244
[11]  11464  18547   5320 -24287 -13180 -14761  13486  -2902  18582  
8798
[21]  29513  21369 -27830  10578  29509 -13015 -23255 -13784  25643 
11960
[31]  -4233  -8515  -2123  -6311  -4455  28531  -1163  -2077   -775
-25282
[41]  -6161  -2242 -12679  -2128  27610 -16977  24278 -25369     61 
11268
[51]    532 -27778 -21424 -17619 -29359 -19503 -10426  22632  28771
-20751
[61] -23825 -25437 -24301  -4469
> 

Is it impossilble to use Rsteams function with the connection functions
from the base package or have I missed something? System R 1.3.1 on
Debian Linux.

Thanks, Sven
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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