Hi All,
I just used "dump" on Splus to transfer a pile of survival objects
from
Splus 3.4 on Solaris 7 to R 0.63.3 on Intel.
The only trick is that survival objects contain an element holding the
original call that generated the object. When Splus writes these out, it
doesn't mark them in any way, so when R tries to read them in, it ends up
trying to reevaluate the call. Not nice.
Anyway, as all but one** of the offending calls occur in statements
that look like
[...], call = func( param1, param2, [..] ), class = "myclass"
so I wrote the following perl script to encapsulate each call in
as.call(expression(...)) :
-------begin translate.dump.pl--------
$RS="<-";
$OS="<-";
while(<>)
{
s/call\s*=(.*?),(\s+?)class/call=as.call(expression($1)),$2
class/s;
print $_;
}
---------end translate.dump.pl----------
Now the data can be transfered by :
Splus on Unix:
> dump(ls())
Downloading the resulting "dumpdata" file.
Linux shell:
$ translate.dump.pl < dumpdata > dumpdata.fixed
R on Linux:
> source("dumpdata.fixed")
Just thought this might help someone out...
-Greg
**The only exception was the ".Last.warning" object, which contained
something like
structure( "Warning Message" = offending(call) )
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
A couple of comments for core...
In my examples, it looks like the only calls that need to be evaluated
inside the structure are "c()" and "list()". A heuristic
approach for
loading the dump files, is to assume that any other call ought to be
returned as a call, rather than evaluated. Providing an undump() command
with this behavour might make it easier for people to move data between
Splus and R.
-Greg
On Wed, 31 Mar 1999, Gregory R. Warnes wrote:
GRW>>
GRW>> Hi All,
GRW>>
GRW>> I just used "dump" on Splus to transfer a pile of
survival objects from
GRW>> Splus 3.4 on Solaris 7 to R 0.63.3 on Intel.
GRW>>
GRW>> The only trick is that survival objects contain an element holding
the
GRW>> original call that generated the object. When Splus writes these
out, it
GRW>> doesn't mark them in any way, so when R tries to read them in,
it ends up
GRW>> trying to reevaluate the call. Not nice.
GRW>>
GRW>> Anyway, as all but one** of the offending calls occur in
statements
GRW>> that look like
GRW>> "blah" <- structure( [...], call = func( param1,
param2, [...], )
GRW>> class = "myclass" [...] )
GRW>>
GRW>> so I wrote the following perl script to encapsulate each call in
GRW>> as.call(expression(...)) :
GRW>>
GRW>> -------begin translate.dump.pl--------
GRW>> $RS="<-";
GRW>> $OS="<-";
GRW>>
GRW>> while(<>)
GRW>> {
GRW>>
s/call\s*=(.*?),(\s+?)class/call=as.call(expression($1)),$2
GRW>> class/s;
GRW>> print $_;
GRW>> }
GRW>> ---------end translate.dump.pl----------
GRW>>
GRW>> Now the data can be transfered by :
GRW>>
GRW>> Splus on Unix:
GRW>> > dump(ls())
GRW>>
GRW>> Downloading the resulting "dumpdata" file.
GRW>>
GRW>> Linux shell:
GRW>> $ translate.dump.pl < dumpdata > dumpdata.fixed
GRW>>
GRW>> R on Linux:
GRW>>
GRW>> > source("dumpdata.fixed")
GRW>>
GRW>> Just thought this might help someone out...
GRW>>
GRW>>
GRW>> -Greg
GRW>>
GRW>>
GRW>> **The only exception was the ".Last.warning" object,
which contained
GRW>> something like
GRW>> structure( "Warning Message" = offending(call) )
GRW>>
GRW>>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Gregory R. Warnes writes: > > Hi All, > > I just used "dump" on Splus to transfer a pile of survival objects from > Splus 3.4 on Solaris 7 to R 0.63.3 on Intel. > > The only trick is that survival objects contain an element holding the > original call that generated the object. When Splus writes these out, it > doesn't mark them in any way, so when R tries to read them in, it ends up > trying to reevaluate the call. Not nice. > > Anyway, as all but one** of the offending calls occur in statements > that look like > [...], call = func( param1, param2, [..] ), class = "myclass" > > so I wrote the following perl script to encapsulate each call in > as.call(expression(...)) : I just tried dumping and sourcing/restoring an "lm" object under Splus-3.4, it doesn't work there either! This is very nasty indeed. We can fix the problem in R by inserting quote() around call objects, when we deparse, but what about Splus? It seems like you may want to design your scripts to provide a solution to the problem in both platforms. Ross -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._