Skip to content
Prev 201573 / 398506 Next

Test Binary File

On 25/11/2009 7:34 AM, Jason Rupert wrote:
You can write your own.  For example,

f <- tempfile()
writeBin(as.numeric(1:100), f)

The hexView package is very nice for seeing what you've got:

library(hexView)
viewRaw(f)

which will show something like this:

 0  :  00 00 00 00 00 00 f0 3f 00 00 00 00 00 00 00 40  |  .......?.......@
 16  :  00 00 00 00 00 00 08 40 00 00 00 00 00 00 10 40  |  ....... at .......@
 32  :  00 00 00 00 00 00 14 40 00 00 00 00 00 00 18 40  |  ....... at .......@
...

viewRaw(f, human="real")

will show

  0  :  00 00 00 00 00 00 f0 3f 00 00 00 00 00 00 00 40  |    1   2
 16  :  00 00 00 00 00 00 08 40 00 00 00 00 00 00 10 40  |    3   4
 32  :  00 00 00 00 00 00 14 40 00 00 00 00 00 00 18 40  |    5   6
 48  :  00 00 00 00 00 00 1c 40 00 00 00 00 00 00 20 40  |    7   8
...

Duncan Murdoch