[R] Transferring data from S+ to R

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 14 10:58:25 CET 1999


On Thu, 14 Jan 1999, Zivan Karaman wrote:

> I would like to know if there is an easy way to transfer all the data from
> a S+ directory (".Data" or "_data") to an R image? I would like to transfer
> all the functions and all the data sets (data frames, vectors, lists, etc.).
> 
> I'm working under Windows NT and am using S+ 3.3 for Windows.

R version? I'll assume rw0631.

You could try

In S-PLUS

dump(ls(), "dirdump", T)

in R (having set a large enough workspace)

source("dirdump")
save.image()

This is not guaranteed to work: R is not S and for example S objects can
have storage modes not supported in R, and the functions may not be valid
R, but it will give you a start and you can edit the file dirdump to
change such things, as it will be a text file in the S language.

Remember that source will not work unless the file is entirely correct:
you may see more of what is going on by using rterm and a batch file
(details in the V&R R complements).

The same ideas work for the reverse transfer: in R you need

dump(ls(all.names=T), "dirdump")

but if the help page is up-to-date `the implementation of dump is very
incomplete'.

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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