[R] Reading single precision floats from binary file

Kjetil Kjernsmo kjetil.kjernsmo at astro.uio.no
Thu Feb 15 17:04:48 CET 2001


Dear all,

I have a few files with binary data written by a C program a friend wrote.
I allready have program to read these files, Thomas Lumley and Prof Brian
D Ripley was kind enough to respond to a question to this list earlier
with some code that works perfectly, so this is really no problem, it is
more out curiousity.

Most of my files consists of 40000 single precision floats, and I figured
the new readBin() function exists for the purpose of reading such files,
so I tried to use it, but with no success.

Now, the docs say that what you can read is "numeric", "double",
"integer", "int", "logical", "complex", "character", and since "single" is
not on the list, is it simply not the right tool for the job?
I tried different things, among them, providing single as what,
changing the size, etc, but it always ends up with reading 20000 records,
indicating that it does read the file as double precision floats.

It is not clear to me what the last sentence in the notes for this
function means, and indeed not quite clear what the function does at all,
but I was hoping someone can enlighten me.

Best,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj at astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster at skepsis.no




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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