[R] Reading Version 4 .sdd files

John Chambers jmc at research.bell-labs.com
Tue Oct 5 19:31:26 CEST 2004


John Chandler wrote:

> Dear R-Help,
> 
> I've never had any trouble importing data into R until I had to import
> an .sdd file for a class. The file can be found here:
> http://www.math.umt.edu/steele/Math%20549/Farms.sdd. It begins with the
> line "## Dump S Version 4 Dump ##". I first attempted read.S which
> issued the message "not an S object". I then checked the Import/Export
> manual which seemed to indicate that data.restore might do the trick.
> Alas, it seems that function is trying to interpret the name of the data
> frame as an S mode or some such thing.
> 
> Searched the archives (courtesy of Dr. Baron) and found this from Dr.
> Ripley: ".sdd files from S-PLUS 6.0 are
> S4 dumps, and will not work." This was written in 2002, is it still
> accurate? Right now my only obvious course of action is to get on a
> machine that has S+, read in this file and dump it in a more useful
> format. Are their others?
> 

The S Version 4 dump format is described, somewhat briefly, in my
"Programming with Data", pp 234-241.  It would not be particularly hard
to write a "reader" for the format, but as far as I know, this has not
been done.

Whether it's a good idea to read these dumps into R would depend on what
data is stored there.  For reasonably simple objects, the format is
pretty obvious & the results would likely be fine.

As the objects get more complicated, it's unlikely that the format will
contain enough infomation, without the definition of the classes of the
objects, to recreate them in R.

The purpose of the data dump was to generate a portable & fully general
dump for objects--"portable" however meaning between machines running
the same system (with the same class definitions).

In particular, if the objects were generated from a formally defined
("S4") class, the object as dumped will not give you much of a clue
without the definition of the class.  Nor, for that matter, will the
ordinary dump() output, but that at least may be re-executable, once you
have the correct class definition.

In either case, you would need to get the S-language definition of the
class.

John Chambers




More information about the R-help mailing list