R-beta: Accessing S-plus objects from R -- no. Must use ASCII files.

Martin Maechler maechler at stat.math.ethz.ch
Mon Oct 20 15:49:43 CEST 1997


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


More information about the R-help mailing list