[R] Plotting large texts into pdf file

Pfaff, Bernhard Bernhard.Pfaff at drkw.com
Tue Sep 28 10:53:26 CEST 2004


> 
> Is there an easy way to include larger amounts of text in a plot?
> I need to include a text report in a pdf file that is automtically
> created by a R script.
> 
> I open a pdf device, then create several plots which are nicely output
> each on a page in
> the resulting pdf file, then I want to append page(s) that 
> contain only
> text.
> 
> The best I came up with is the following:
> 
> # create a new page
> frame()
> # setup some dummy coordinate system
> plot.window(c(0,10),c(0,10))
> # read the report as whole file (vector of lines)
> f <- readLines(filename)
> # concatenate the first 50 lines into on string with lines 
> separated by
> \n newline
> t <- paste(f[1:50], collapse="\n")
> # output text
> text(0, 5, t, pos=4, cex=0.8, xpd=NA)
> 
> The problem is that the text is always centered in some way 
> (with pos =
> 4 vertically,
> and I cant easily put it into several pages.
> 
> Is there an easier way to do this that I overlooked?
> 
> For automation reasons I would like to have R output the text directly
> into the pdf.


Have you considered Sweave()? There is also a nice and well written tutorial
by Friedrich Leisch in R News:
 
Friedrich Leisch. Sweave, part I: Mixing R and LATEX. R News, 2(3):28-31,
December 2002
Friedrich Leisch. Sweave, part II: Package vignettes. R News, 3(2):21-24,
October 2003

as well as the referenced URLs within this tutorial.

HTH,
Bernhard

> 
> Thanks in advance
> 
> Michael
> 
> 
> **********************************************************************
> Der Inhalt dieser E-Mail ist vertraulich und ausschliesslich 
> fuer den bezeichneten Adressaten bestimmt. Wenn Sie nicht der 
> vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein 
> sollten, so beachten Sie bitte, dass jede Form der 
> Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder 
> Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir 
> bitten Sie, sich in diesem Fall mit dem Absender der E-Mail 
> in Verbindung zu setzen.
> 
> ______________________________________________
> 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


--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}




More information about the R-help mailing list