[R] Include "print" output into plots

Frank E Harrell Jr fharrell at virginia.edu
Sun Nov 24 14:37:41 CET 2002


On Sun, 24 Nov 2002 12:37:44 +0100
Klaus Thul <Klaus.Thul at t-online.de> wrote:

> Hello,
> 
> I would like to set up some automatic reporting using R. For this purpose, I 
> need to include the output of "print" commands into the graphics produced by 
> some "plot" commands.
> 
> 1. Is there an easy way to do this?
> 
> 2. Is it possible to redirect "print" into a string? 
>     (except redirecting into a file and than scanning back?)
> 
> 3. What is the best way to get a multi-line string printed into a plot window?
> 
> Thanks in advance for any help.
> 
> Klaus
> 
> ----
> Klaus Thul, Stauffenbergallee 5a, 01099 Dresden, +49 351 8020502

Klaus - this was an active discussion on r-help just a few days ago.  Please check the e-mail archives available through www.r-project.org.  You can start with text(x,y,'First Line\nSecond Line') but there are more general approaches for writing blocks of text onto graphics.  The most beautiful outcome in my opinion is obtained using LaTeX, so I strongly encourage you to look at Sweave in the tools package, or to construct a customized interface between R and LaTeX as I am working on for clinical trial reports.  Slides for my recent talk on this may be obtained at
http://hesweb1.med.virginia.edu/biostat/presentations/feh/clinreport/dmcreport.pdf

With LaTeX the text, tables, and graphics are intermixed in a professional way.  I am finding good success in using R and high-level graphics and LaTeX interface functions in the Hmisc library for pharmaceutical research statistical reports.  Having R generate all tables, graphics, LaTeX graphics inclusion macro calls, and figure captions, and using pdflatex with hyperref to automatically hyperlink everything has many advantages.  For reports that are not run repeatedly over time (so that it is not worth the time of special customizations), Sweave is a wonderful tool and LaTeX is one of the best productivity tools ever invented (and it is free too).
-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list