[R] S <-> R
tplate at blackmesacapital.com
Wed Aug 25 20:10:45 CEST 2004
I think the issue is that dput() and dget() don't work for some more
complex structures (as you point out, they do appear to work for simple
structures). The R Data Import/Export manual doesn't mention using dput
and dget to transfer objects between R and S-PLUS, perhaps because these
functions have limited coverage?
S-PLUS6.1> junk <- list(f=as.name("g"))
S-PLUS6.1> data.dump("junk", file="junk2.dat", oldStyle=F)
S-PLUS6.1> data.dump("junk", file="junk3.dat", oldStyle=T)
Error in eval(expr, envir, enclos) : Object "g" not found
R> # with package "foreign" loaded
Error in ReadSdump(TRUE, " ") : S mode "junk" (near byte offset 45) not
In addition: Warning message:
NAs introduced by coercion
-- Tony Plate
At Wednesday 11:45 AM 8/25/2004, Rolf Turner wrote:
>I'm puzzled by the discourse in this thread. Briefly, dput() and
>dget() seem to work just fine for me.
> > junk <- list(x=rnorm(20),y=sample(1:100,12,TRUE))
> > dput(junk,"junk.dat")
>in Splus (Version 6.1.2 Release 2 for Sun SPARC, SunOS 5.6 : 2002)
>and then in R
> > junk <- dget("junk.dat")
>system sparc, solaris2.9
>There were no complaints, and typing ``junk'' in the R window
>and in the Splus window appeared to produce indentical results.
>So what's the problem?
> Rolf Turner
> rolf at math.unb.ca
>Tony Plate wrote:
> > Have you tried following the advice in the R Data Import/Export
> manual? It
> > suggests the following:
> > >Function data.restore reads S-PLUS data dumps (created by data.dump) with
> > >the same restrictions (except that dumps from the Alpha platform can also
> > >be read).
> > >It should be possible to read data dumps from S-PLUS 5.x and 6.x
> written with
> > >data.dump(oldStyle=T).
> > -- Tony Plate
> > At Wednesday 10:29 AM 8/25/2004, Zachary Skrivanek wrote:
> > >Hello! I would like to be able to read in list data objects in R/S
> > >created in R/S. (Ie R->S or S->R.) I have tried 'dput' and 'dump' in S,
> > >but neither of the created files could be read into R (with 'dget' nor
> > >'source'). Is there any way that I can save a list object in S that can
> > >be read into R?
> > >
> > >Sincerely,
> > >Zachary Skrivanek, PhD
> > >Research Scientist
> > >Program Phase Statistics-Endocrine
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help