From murdoch@stats.uwo.ca  Thu Jun 29 18:46:25 2000
From: murdoch@stats.uwo.ca (Duncan Murdoch)
Date: Thu, 29 Jun 2000 13:46:25 -0400
Subject: [Rd] Binary file functions in R
Message-ID: <395c8897.556056@fisher.stats.uwo.ca>

This is just to let people know that I'm going to try to put together
a little package of binary file read/write functions for R, along the
lines described in my message in r-help.  I'm going to do it first in
R for Windows using a DLL written in Delphi; I'll let people comment
on that, and once the design settles down, I'll redo the external code
in C so that it should be portable to Unix as well.

One immediate change from my first pass suggestion below:

I'll just have readint, readfloat, readchar; the size and whether
signed or unsigned will be determined by parameters to those
functions.

Other suggested changes are welcome!

Duncan Murdoch

>I think a set of stream like functions would be really handy
>sometimes, especially for those of us who aren't that comfortable with
>the external function interface.
>
>For example:
>
>fopen would take a filename and some information about the open mode
>(read and write would probably be enough modes) and would return a
>file handle.
>
>readint8, readint16, readint32, readint64 would read a specified count
>of integers into an integer vector.
>
>readfloat4, readfloat8 would read a specified count of floating point
>values into a vector of doubles.
>
>readchar would read a specified count of characters into a single
>component character vector, or take two counts, and read n characters
>m times into an m component vector.
>
>There would be similar writexxxx functions, a seek function, and an
>fclose function.
>
>Some issues to consider would be whether these functions should worry
>about big vs. little endian storage (I'd say probably not, but there
>should be other functions that can change it in memory), how errors
>should be handled, whether the garbage collector should be smart
>enough to automatically close an abandoned file, whether you should be
>allowed to use these low level functions on things in memory or just
>on files, etc.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Binary file functions in R
Duncan Murdoch