"Jean-Francois Gibrat" <gibrat at proline.jouy.inra.fr> writes:> I am currently trying to switch from Splus to R and I would like to know > whether there is a way of transfering Splus objects stored on disk into the R > environment. In Splus I would do this using the function get, e.g., foo <- > get(foo,where="dirname") where dirname is the name of a directory containing > the Splus objects. In R, argument 'where' of function get appears to be > replaced by argument 'envir', whose meaning is rather nebulous for me at the > moment.....The internal representations of objects in S-PLUS and R are similar, but different. The "get" function as you have used it above retrieves the internal representation of the object. It is unlikely that a method could be constructed for R that would make sense of all such S-PLUS objects. You may have better luck using a combination of "ed" in S-PLUS and "source" in R or, even better, use the emacs modes from the ESS (Emacs Speaks Statistics) library (ftp://ftp.math.sc.edu/rossini/) to run S-PLUS in one buffer and R in another buffer. In the S-PLUS buffer you dump the object in a printable form then from that buffer you load the object into the R process. This may sound confusing but the basic idea is that you have to go to some printable form of the object so you can transfer it from one system to the other. One thing I would like to see is the ability of R to parse the data.dump format of objects created by S. Has anyone looked at this at all? -- Douglas Bates bates at stat.wisc.edu Statistics Department 608/262-2598 University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Martin Maechler
1997-Oct-20 13:49 UTC
R-beta: Accessing S-plus objects from R -- no. Must use ASCII files.
Salut Jean-Fran?ois, (( you should really use a "Subject:..." in your postings... ))>>>>> "JFG" == Jean-Francois Gibrat <gibrat at proline.jouy.inra.fr> writes:JFG> I am currently trying to switch from Splus to R and I would like JFG> to know whether there is a way of transfering Splus objects stored JFG> on disk into the R environment. No, there's no direct way. However, see below for a solution. JFG> In Splus I would do this using the JFG> function get, e.g., foo <- get(foo,where="dirname") where dirname JFG> is the name of a directory containing the Splus objects. In R, JFG> argument 'where' of function get appears to be replaced by JFG> argument 'envir', whose meaning is rather nebulous for me at the JFG> moment..... Thanks for answering me. Sorry if this question has JFG> been already asked zillion of times, as it is likely to have been. not quite a zillion.... I think the new (not-yet-released) version of the FAQ will help you quite a bit more here [[I assume you looked at the current released FAQ ...]] Big difference S <-> R: In S / Splus, objects are stored as single files in Data directories. (at least conceptually, in S-plus Windows, this is not quite true..). In R, they are only stored in memory, or as part of the ``image'', when you use save(..) or q("yes") {{and they are reloaded automatically if the image is called ".RData" and is in your current directory, or by load(...) explicitly.}} Most of ``us'' however use source files and source(..) (and Emacs S-mode / R-mode ...) for our own functions and things. If you use HUGE data sets, R is not really there yet with ``memory-mapped'' objects. Solution of your problem: Get your data and function into R, using source(.) scan(.) and/or read.table(.). To this end, you must save your S-plus objects in the proper format from WITHIN S-plus, using dump(..) [then you'll use source(..)] or write(..) / write.table(..), then use scan(.) or read.table(.). I hope this helps. Martin Maechler <maechler at stat.math.ethz.ch> <>< Seminar fuer Statistik, SOL G1 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1086 http://www.stat.math.ethz.ch/~maechler/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
R does not read the Splus data storage format. To transport objects between Splus and R, I've used dump() in Splus to save the object in a text file, and then use source() in R to read it in. On Mon, 20 Oct 1997, Jean-Francois Gibrat wrote:> Hi, > > > > I am currently trying to switch from Splus to R and I would like to know > whether there is a way of transfering Splus objects stored on disk into the R > environment. In Splus I would do this using the function get, e.g., foo <- > get(foo,where="dirname") where dirname is the name of a directory containing > the Splus objects. In R, argument 'where' of function get appears to be > replaced by argument 'envir', whose meaning is rather nebulous for me at the > moment..... > Thanks for answering me. Sorry if this question has been already asked zillion > of times, as it is likely to have been. > > > > -- > > > > =========================================================================> Jean-Francois Gibrat Tel: +33 (1) 34 65 25 67 > Unite de Bio-Informatique, Fax: +33 (1) 34 65 22 41 > Batiment des Biotechnologies, Email: gibrat at proline.jouy.inra.fr > INRA, Jouy-en-Josas, 78352, France > > > > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-> 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 > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->------------------------------------------------------------------------------- Gregory R. Warnes | It is high time that the ideal of success warnes at biostat.washington.edu | be replaced by the ideal of service. | Albert Einstein ------------------------------------------------------------------------------- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Hi, I am currently trying to switch from Splus to R and I would like to know whether there is a way of transfering Splus objects stored on disk into the R environment. In Splus I would do this using the function get, e.g., foo <- get(foo,where="dirname") where dirname is the name of a directory containing the Splus objects. In R, argument 'where' of function get appears to be replaced by argument 'envir', whose meaning is rather nebulous for me at the moment..... Thanks for answering me. Sorry if this question has been already asked zillion of times, as it is likely to have been. -- =========================================================================Jean-Francois Gibrat Tel: +33 (1) 34 65 25 67 Unite de Bio-Informatique, Fax: +33 (1) 34 65 22 41 Batiment des Biotechnologies, Email: gibrat at proline.jouy.inra.fr INRA, Jouy-en-Josas, 78352, France =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=