Hi I create one pdf file with plots via pdf() and one text file with text via sink() that works very nice. But I would prefer to have one pdf file with plots and the text which I store in the te=xt file via sink(). I.e. x.lm<-lm(...) pdf() plot(x.lm) NOW THE TEXT OF summary(xlm) IN THE PDF FILE dev.off() Is this possible or is there a different format which I could use? Rainer
On Wed, 17 Oct 2007, Rainer M Krug wrote:> Hi > > I create one pdf file with plots via pdf() and one text file with text > via sink() that works very nice. But I would prefer to have one pdf file > with plots and the text which I store in the te=xt file via sink(). I.e. > > x.lm<-lm(...) > pdf() > plot(x.lm) > NOW THE TEXT OF summary(xlm) IN THE PDF FILE > dev.off() > > Is this possible or is there a different format which I could use?You can easily post-process the files to obtain a single file. Going from text to pdf involves many arbitrary choices, but a good text processor will help you make those and incorporate pdf figures: I would use pdflatex, but there are many other tools to do the job. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley wrote:> On Wed, 17 Oct 2007, Rainer M Krug wrote: > >> Hi >> >> I create one pdf file with plots via pdf() and one text file with text >> via sink() that works very nice. But I would prefer to have one pdf file >> with plots and the text which I store in the te=xt file via sink(). I.e. >> >> x.lm<-lm(...) >> pdf() >> plot(x.lm) >> NOW THE TEXT OF summary(xlm) IN THE PDF FILE >> dev.off() >> >> Is this possible or is there a different format which I could use? > > You can easily post-process the files to obtain a single file. Going > from text to pdf involves many arbitrary choices, but a good text > processor will help you make those and incorporate pdf figures: I would > use pdflatex, but there are many other tools to do the job. >Thanks for pointing out the post-processing route (I have done similar script based pdf creations via pdflatex before), but I would like to have something only for me to make it easier to read the results. It does not need to be nicely layouted - just the text in the pdf in whatever font would be fine.
I use Sweave for this kind of purposes. HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx op inbo.be www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney> -----Oorspronkelijk bericht----- > Van: r-help-bounces op r-project.org > [mailto:r-help-bounces op r-project.org] Namens Rainer M Krug > Verzonden: woensdag 17 oktober 2007 11:02 > Aan: Prof Brian Ripley > CC: r-help > Onderwerp: Re: [R] One pdf file with plots and text output > > Prof Brian Ripley wrote: > > On Wed, 17 Oct 2007, Rainer M Krug wrote: > > > >> Hi > >> > >> I create one pdf file with plots via pdf() and one text file with > >> text via sink() that works very nice. But I would prefer > to have one > >> pdf file with plots and the text which I store in the > te=xt file via sink(). I.e. > >> > >> x.lm<-lm(...) > >> pdf() > >> plot(x.lm) > >> NOW THE TEXT OF summary(xlm) IN THE PDF FILE > >> dev.off() > >> > >> Is this possible or is there a different format which I could use? > > > > You can easily post-process the files to obtain a single > file. Going > > from text to pdf involves many arbitrary choices, but a good text > > processor will help you make those and incorporate pdf figures: I > > would use pdflatex, but there are many other tools to do the job. > > > Thanks for pointing out the post-processing route (I have > done similar script based pdf creations via pdflatex before), > but I would like to have something only for me to make it > easier to read the results. > It does not need to be nicely layouted - just the text in the > pdf in whatever font would be fine. > > ______________________________________________ > R-help op 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. >
Maybe with:> print(plot.new()) > mtext(summary(xlm))Regards, Olivier Delaigue Rainer M Krug-2 wrote:> > Hi > > I create one pdf file with plots via pdf() and one text file with text > via sink() that works very nice. But I would prefer to have one pdf file > with plots and the text which I store in the te=xt file via sink(). I.e. > > x.lm<-lm(...) > pdf() > plot(x.lm) > NOW THE TEXT OF summary(xlm) IN THE PDF FILE > dev.off() > > Is this possible or is there a different format which I could use? > > Rainer > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/One-pdf-file-with-plots-and-text-output-tf4638970.html#a13249998 Sent from the R help mailing list archive at Nabble.com.
On 17 October 2007 at 10:44, Rainer M Krug wrote:
| I create one pdf file with plots via pdf() and one text file with text
| via sink() that works very nice. But I would prefer to have one pdf file
| with plots and the text which I store in the te=xt file via sink(). I.e.
|
| x.lm<-lm(...)
| pdf()
| plot(x.lm)
| NOW THE TEXT OF summary(xlm) IN THE PDF FILE
| dev.off()
|
| Is this possible or is there a different format which I could use?
Yes -- using textplot() from the gplots package. Cut & paste from its
example:
### Make a nice 4 way display with two plots and two text summaries
data(iris)
par(mfrow=c(2,2))
plot( Sepal.Length ~ Species, data=iris, border="blue",
col="cyan",
main="Boxplot of Sepal Length by Species" )
plotmeans( Sepal.Length ~ Species, data=iris, barwidth=2, connect=FALSE,
main="Means and 95% Confidence Intervals\nof Sepal Length
by Species")
info <- sapply( split(iris$Sepal.Length, iris$Species),
function(x) round(c(Mean=mean(x), SD=sd(x),
N=gdata::nobs(x)),2) )
textplot( info, valign="top" )
title("Sepal Length by Species")
reg <- lm( Sepal.Length ~ Species, data=iris )
textplot( capture.output(summary(reg)), valign="top")
title("Regression of Sepal Length by Species")
par(mfrow=c(1,1))
So textplot(capture.output(summary(xlm)) may become be your new best friend.
Hth, Dirk
--
Three out of two people have difficulties with fractions.