Re: [R] Possible bugs in 'seek' and 'readBin'

From: Zepu Zhang <zpzhang_at_uchicago.edu>
Date: Sun 22 Oct 2006 - 16:47:06 GMT


Sorry I can't provide reproducible code because it involves data files. I saw no warning messages.

I'm using Mac 10.3, but the R is compiled by myself from command line. I'm reading in data from a XDR formatted file. The first 4 bytes is a 'long' integer, the remainder is double.

I can read in the doubles with

readBin(fid, 'double', n, 4, endian = 'swap')

n >= 1. No problem. However,

readBin(fid, 'integer', 1, 4, endian = 'swap') readBin(fid, 'int', 1, 4, endian = 'swap')

return
""

I think even if the type is wrong, the result shouldn't be an empty string.

I have addresses a1, a2, a3, ...
When I do

seek(fid, a1)
...

seek(fid, a2)
...

seek(fid, a3)
...

The results are correct. But they're not if I do

seek(fid, a1)
...

seek(fid, a2 - a1, origin = 'current')
...

seek(fid, a3 - a2, origin = 'current')
...



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Oct 23 02:53:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 22 Oct 2006 - 18:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.