[R] How to generate a report with graphics and tables?

Rogers, James A [PGRD Groton] James_A_Rogers at groton.pfizer.com
Fri Jan 30 15:57:36 CET 2004

Just to expand on an earlier suggestion:

> > I have some data sets which change on a daily bases. So far I have 
> > imported these sets into R, done all my evaluations resulting in a 
> > couple of plots, charts and tables of numbers which I copy&pasted via>
  > clipboard into Powerpoint. 
> > The procedure is always the same and I wonder, whether there is no 
> > easier way for doing so. Is there some type of "report generator" 
> > available or some HowTo on this. 
> > 
> > Can anybody give me a hint on where to look for? 
> > 
> > Regards, 
> > 
> > Olaf Bürger 


> One other possibility is to use the R2HTML package (and maybe the xtable>
  package, too) to write the `report' in HTML. 
> HTH, 
> Andy 

R2HTML is not (yet) as far along as Sweave, but depending on how much
sympathy you have for your clients, html can be a very nice solution. An
important requirement for many reports is that computer-naive clients be
able to edit and copy from the reports to an MS application, preferably
without severe font and formatting problems and without needing to
install/understand <foo>2<bar> type applications. See comments to this
effect in the recent R2HTML article by the package author, Eric Lecoutre in
the most recent R News (vol 3/3). As Andy noted, xtable is nice to use in
conjunction with R2HTML (just write a little xtable method like the one
following this message):

In particular, a naive user viewing the html file with Internet Explorer (I
know v. 5.5 or greater will work) will have an option, under the File menu
to "Edit with Microsoft Word for Windows". This assumes they have set MS
Word as their HTML editor within IE. It also assumes some minimal formatting
requirements for the HTML file (but you can worry about this, the client
won't have to). 

I find this solution keeps everyone happy:
1. I can auto-generate text source for my documents;
2. clients without proprietary software can view the report; 
3. clients with standard MS software but without a clue can easily edit and


HTML.xtable <- function(x, file = .HTML.file, append = TRUE) {
  sink(file = file, append = append)
  print(x, type = "html")

James A. Rogers 
Manager, Nonclinical Statistics
PGR&D Groton Labs
Eastern Point Road (MS 8260-1331)
Groton, CT 06340
office: (860) 686-0786
fax: (860) 715-5445

LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

More information about the R-help mailing list