[R] reading short int and float from binary connection

Angel Lopez angel_lul at hotmail.com
Wed Mar 17 10:35:48 CET 2004


Hi,
I have a binary file with mixture of short integers (2 bytes) and floats 
(4 bytes).
To get the data into R I use readBin reading each value one at a time 
(n=1) but it is giving me headaches, two questions:
-In the "what" option is there any difference between "integer" and "int"?
-To read the short int I use what="int" and size=2 and to read the 
floats I use what="double" and size=4, the strange thing is that 
sometimes it works but other times it reads wrong values.
Any clues where my mistake might be?
Thanks
Angel




More information about the R-help mailing list