RData File Specification?
On Fri, 24 Aug 2007, Simon Urbanek wrote:
On Aug 24, 2007, at 2:06 PM, Hin-Tak Leung wrote:
I was going to write 'Use the source, Luke', but it seems that you have alreday found the relevant source files. I wrote a Python baed Rdata writer and a reader sometimes ago just using that info and I am not away of any file spec, so I know those two files are sufficient. For what you want to do, I think you'll have to write some fairly substantial code to process the Rdata as just XDR stream (as my python scripts do, using the python built-in xdrlib),
Unfortunately the format is not true XDR (it is not padded properly - CHARs (incl. symbols etc.) and raw vectors violate the padding rules), so you have to fall back to low-level access for some parts. It effect, the only part of XDR used is the storage of int and double (which is quite trivial), so IMHO any language (even without XDR) will do ...
I don't think XDR for doubles is 'quite trivial': it is if your native
format is the conventional IEC60559 representation (when all you have to
worry about is byte order), but not in general. (Some of us remember
interworking with Vaxen, for example.)
Note that the format is not actually claimed to be XDR: ?save says
All R platforms use the XDR representation of binary objects in
binary save-d files, and these are portable across all R
platforms.
That was probably written before RAWSXPs, but it is not claiming that
character strings are written in XDR. (RFC 1832 seems to expect ASCII
character strings, so XDR string format would be a pain to use.)
[...]
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595