Re: [Rd] RData File Specification?

From: Hin-Tak Leung <hin-tak.leung_at_cimr.cam.ac.uk>
Date: Mon, 27 Aug 2007 00:53:11 +0100

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 ...
>
> Cheers,
> Simon

Yes, I found out about the char not-padding-to-multple-of-4-byte part the "hard" way. Still, the python xdrlib library saved me a bit of hassle abstracting away from endian issues - since I work mostly on small endian machines and xdr-based data being bigendian -, even though I had to "backtrack" my file pointers in the cases of padding char/raw's...

Anyway, "the source is your guide"...

<snipped>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 26 Aug 2007 - 23:56:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 27 Aug 2007 - 13:39:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.