[R] Saving R objects

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jul 24 21:08:57 CEST 2006


out.data.mat can be created compactly using with:

out.data.mat <- with(mult.comp,
   cbind(estimate, conf.int, p.value.raw = c(p.value.raw),
p.value.bon, p.value.adj)
)


On 7/24/06, Nair, Murlidharan T <mnair at iusb.edu> wrote:
> I explicitly did is this way
>
> isoforms<-as.vector(rownames(mult.comp$estimate))
> estimate<-as.vector(mult.comp$estimate)
> lower<-as.vector(mult.comp$conf.int[,1])
> upper<-as.vector(mult.comp$conf.int[,2])
> p.val.raw<-as.vector(mult.comp$p.value.raw)
> p.val.bon<-as.vector(mult.comp$p.value.bon)
> p.val.adj<-as.vector(mult.comp$p.value.adj)
> out.data.mat<-cbind(isoforms,estimate,lower,upper,p.val.raw,p.val.bon,p.val.adj)
> write.table(out.data.mat, file=filename.csv, sep=",", qmethod="double", col.name=NA)
>
> Thanks ../Murli
>
> ________________________________
>
> From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com]
> Sent: Sun 7/23/2006 10:11 PM
> To: Nair, Murlidharan T
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Saving R objects
>
>
>
> It depends on what information you want to save and how the
> program on the other end needs it.
>
> For the save version I would at least use ascii = TRUE to get it
> in a more readable fashion.
>
> Look at
>
> file.show("mult_test.dat")
> file.show("mult.out")  # but use ascii=TRUE on your save statement.
>
> to see what you are getting.
>
> Other possibilities are to use R2HTML or XML packages to output
> to HTML or XML.   You might want to handle the various components
> of Dcirec separately.  To see what's inside:
>
>   unclass(Dcirec)
>   str(Dcirec)
>   dput(Dcirec)
>
> and use cat statements to output the components in the format of
> your choice possibly in conjunction with sprintf.
>
>
> On 7/23/06, Nair, Murlidharan T <mnair at iusb.edu> wrote:
> > I am trying to find the best way to save the follwoing object I am creating
> >
> > library(multcomp)
> > data(recovery)
> > Dcirec<-simint(minutes~blanket, data=recovery, conf.level=0.9, alternative="less")
> >
> > I am probably not doing it the most efficient way I think.
> > Here is what I am doing
> >
> > a<-print(Dcirec)
> > write(a,file="mult_test.dat", append=T)
> > or
> > save(Dcirec, file="mult.out")
> >
> > Which is the best way to save it, so that I can access its contents outside the R environment?
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>



More information about the R-help mailing list