Skip to content

Restoring an S object that was data-dumped

6 messages · Ravi Varadhan, Roger D. Peng, Spencer Graves +2 more

#
Hi:

In R, how can I "data.restore" an object that was "data.dump"ed in 
Splus (I am not sure of the exact version, but probably Splus5)? 
When I use data.restore, I get the following error message (I am using 
R 1.7.0 on Windows)
Error in ReadSdump(TRUE, " ") : S 
mode "        "Netherlands", "Ireland", "Denmark", "Norway", " 
Sweden", "Finland"," (near byte offset 230) not supported
In addition: Warning message: 
NAs introduced by coercion
Thanks for any help,
Ravi.
#
Have you tried 'help.search("data.restore")' or the "posting 
guide" at "http://www.R-project.org/posting-guide.html"?  I believe the 
object of your desires (at least for this request) is in 
"library(foreign)". 

      hope this helps. 
      spencer graves
Ravi Varadhan wrote:

            
#
Obviously, it was data.restore() that produced the error 
below.  However, I think S-PLUS 5 might not be supported by 
data.restore() in the `foreign' package since the docs there 
say it can only read objects from S-PLUS versions 3.x and 
4.x (on Unix).

-roger
Spencer Graves wrote:
#
1.  Could  you upgrade to the latest version of R (1.8.1)?  I 
don't know if it will help, but it might. 

      2.  I just used Notepad to open a data.dump file created in S-Plus 
6.2.  It started, "## Dump S Version 4 Dump ##".  How does your 
data.dump file begin? 

      3.  If you upgrade and can't solve the problem any other way, you 
could list out the "data.dump" code and step through it one line at a 
time until you identify the problem and a way to fix it -- at least in 
your case.  A "data.dump" file seems to be plain text, which means that 
it can be modified in a text editor, provided you know what to change. 

      hope this helps.  spencer graves
Roger D. Peng wrote:

            
#
On Tue, 20 Jan 2004, Roger D. Peng wrote:

            
Correct.  We don't have a description of the S4 (hence S-PLUS 5.x and 6.x) 
data.dump format.  We recommend using data.dump(oldStyle=T) in those 
versions of S-PLUS if possible.

  
    
#
On Tue, 20 Jan 2004 19:42:51 +0000 (GMT), Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote :
I developed the data.restore code that's there by recognizing that the
data.dump output was closely related to the binary format, which I had
reverse-engineered several years before.

I imagine there are a couple of possibilities to update it to the
newer format:

1.  We could approach Insightful, and find out if they'd give us specs
for the format.  They might be published somewhere, or they might be
willing to let us base our implementation on their data.restore
function.

This would need someone who knows who to contact at Insightful so as
to maximize the probability of a positive response.  

2.  We could reverse engineer the format.  This is probably easier
than you'd think.  It's just a matter of creating instances of all of
the kinds of objects that you want to be able to read, and seeing what
the dump looks like, and then trying out the procedure on a larger
body of data, and iterating a few times.

It's hopeless to think that many complex objects will ever be
recoverable this way (the internals of R are different than S-PLUS),
but it shouldn't be too hard to get vectors and data.frames, and maybe
functions.

Duncan Murdoch