I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each. So, does anyone know of a valid test set of binary data that I could reference while trying to figure out the technique of using readBin? It would be really helpful to try out readBin on a readily available and understood binary file instead of starting with one of dubious internal structure. Thank you again for your help and feedback.
Do you know how it is structured? Is it 64-bit floating point, 32-bit floating point, 64 bit integer, 32 bit integer, byte values, etc.? If we know the structure, then we can determine how to decode the information. On Wed, Nov 25, 2009 at 7:34 AM, Jason Rupert <jasonkrupert at yahoo.com> wrote:> I've got an error with the way I'm using readBin on a binary file of unknown internal structure. ?I know the structure consists of rows and columns, but I'm not sure how many of each. > > So, does anyone know of a valid test set of binary data that I could reference while trying to figure out the technique of using readBin? > > It would be really helpful to try out readBin on a readily available and understood binary file instead of starting with one of dubious internal structure. > > Thank you again for your help and feedback. > > ______________________________________________ > R-help at r-project.org 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
On 25/11/2009 7:34 AM, Jason Rupert wrote:> I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each. > > So, does anyone know of a valid test set of binary data that I could reference while trying to figure out the technique of using readBin? > > It would be really helpful to try out readBin on a readily available and understood binary file instead of starting with one of dubious internal structure. >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
As an alternative to the hexview package, an external Hex-Editor may help you investigate how the data is organised. -- View this message in context: http://r.789695.n4.nabble.com/Test-Binary-File-tp833690p4633075.html Sent from the R help mailing list archive at Nabble.com.
Possibly Parallel Threads
- Large Binary file reader for Simple minds
- Problem with writeBin and importing into gfortran compiled programs
- Can't read a binary file
- Using readBin to read binary "unformatted" output files from Fortran?
- Problem reading binaries created with fortran (More infos)