[R] question related to S-Plus

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 10 14:10:21 CEST 2004

On Thu, 10 Jun 2004, Pikounis, Bill wrote:

> Hi Rick,
> > learning R.  A question to this end, though.
> > Would all of my existing S-Plus arrays, functions,
> > and so on have to be re-created from scratch in R,
> > or is there a way to copy them into the .RData
> > directory?  The answer to this question has major
> I am not sure if you have had this answered already.  You definitely cannot
> just copy the binary objects into a .RData workspace.  On the S-PLUS side, I
> would try 
> ?data.dump (and particularly, its argument oldStyle if you have S3/S-PLUS
> 2000 or earlier objects), and/or ?dput to get your S-PLUS objects exported
> to ASCII format.  
> Then from the R side, see ?source and ?dget to import things into R objects.
> I do not recall off-hand what the best combinations and argument settings
> are for the most common situations. But I recall the reliability being
> pretty high in my practice if not perfect, which is more than I could ask
> for.  

To clarify that a bit.

For functions, use dump() in S-PLUS and source() in R.

For data objects such as arrays and data frames use data.dump(oldStyle=T) 
(assuming S-PLUS 5.x or 6.x, otherwise just data.dump) in S-PLUS and
data.restore in package foreign to read in.  (That will help keep 
precision, use integers as appropriate etc.)

Also, R does have an `R Data Import/Export Manual' which elaborates on 
such issues.  It is possible to read S-PLUS 4.x (or earlier) objects using 
package foreign, but there is less error checking.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list