[R] S-Plus 2000 <-> R 1.0.1

Douglas Bates bates at stat.wisc.edu
Sat Apr 29 17:39:57 CEST 2000


"Edward J. Czilli" <ejczilli at umich.edu> writes:

> Let's say that I have a data frame in S-Plus 2000 (Win98 version). 
> 
> I want to use the same data frame with R on another computer.
> 
> Questions:
> 
> 1) Can R read S-Plus data frames? 

No, not directly.  The simplest thing to do is to dump the data frame
from S-PLUS to an ASCII file and try to read that into R.  Sometimes
that will work.  Sometimes there are complications with the way
S-PLUS stores factors.

> Can S-Plus 2000 read R data frames?

The reverse route tends to work better.  A file created by dump in R
tends to be easier to read into S-PLUS.

> 2) How can i move the data frame between the two systems?  Do I 
> need to use dump()?

That is probably the most effective way.

For example, in R use

 > data(InsectSprays)
 > str(InsectSprays)
 `data.frame':	72 obs. of  2 variables:
  $ count: num  10 7 20 14 14 12 10 23 17 20 ...
  $ spray: Factor w/ 6 levels "A","B","C","D",..: 1 1 1 1 1 1 1 1 1 1 ...
 > dump("InsectSprays", file = "InsectSprays.q")

If you start S-PLUS you should be able to use
 > source("InsectSprays.q")
to retrieve a copy of the frame.

For the list: When moving objects between computers in R one can use
the R save format (.rda files) because they use a machine-independent
representation.  I believe the preferred way of doing this in S-PLUS
is still to use the S-PLUS data.dump format.

A good project for someone wanting to learn the internals of R would
be to create an R function that reads the S-PLUS data.dump format.  It
would be a great advantage to use C code to read the file and create
the R structures.  Read the manual "Writing R Extensions" before
trying to do this.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list