[R] Add "title" in sink output and possibility of plot-like output for text

Greg Snow Greg.Snow at imail.org
Wed Sep 24 21:47:31 CEST 2008

You could use the cat function to output some text that would then be included in the sinked output file.  Or look at the txtStart and related functions in the TeachingDemos package for an alternative to sink that can include the code interspersed with the output and add additional text using txtComment.  You can even include graphs and some markup if willing to do a little postprocessing.

Look at the textplot function in the gplots package for one way to include the results from summary in one frame of a plot.

Hope this helps,

Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Michael Just
> Sent: Wednesday, September 24, 2008 11:46 AM
> To: r-help at r-project.org
> Subject: [R] Add "title" in sink output and possibility of plot-like
> output for text
> Hello,
> I have been using sink to create text file outputs.
> >sink("summ_model1and2.txt")
> > summary(model1)
> > summary(model2)
> > sink()
> Q1: Is there a way I could add a line of the text above the summary to
> act
> like a title?
> Also, I have been using the following to save plots from the lm
> function:
> > pdf("small.bin.ENN_MN_withQ.pdf")
> > par(mfrow = c(2, 2), oma = c(0, 0, 2, 0))
> > plot(small.bin.ENN_MN)
> > plot(small.bin.ENN_MN.q)
> > dev.off()
> Q2: Is there a way I could save the output from 'summary' into a c(2,2)
> window like I do with the plots?
> Thank you kindly,
> Cheers,
> M Just
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org 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