Publication Quality Output
Compared with SAS and SPSS, R's ability to output results for publication quality reports is rudimentary. I am not aware of any extensions that allow you to output RTF code. Sweave allows you to imbed R code in LaTeX, producing attractive reports if you know that markup language.
The R2HTML package lets you output text, tables, and graphs in HTML format. Here is a sample session, followed by an explanation.
# Sample Session
library(R2HTML)
HTMLStart(outdir="c:/mydir", file="myreport",
extension="html", echo=FALSE, HTMLframe=TRUE)
HTML.title("My Report", HR=1)
HTML.title("Description of my data", HR=3)
summary(mydata)
HTMLhr()
HTML.title("X Y Scatter Plot", HR=2)
plot(mydata$y~mydata$x)
HTMLplot()
HTMLStop()
Once you invoke HTMLStart( ), the prompt will change to HTML> until you end with HTMLStop().
The echo=TRUE option copies commands to the same file as the output.
HTMLframe=TRUE creates framed output, with commands in the left frame, linked to output in the right frame. By default, a CSS file named R2HTML.css controlling page look and feel is output to the same directory. Optionally, you can include a CSSFile= option to use your own formatting file.
Use HTML.title() to annotate the output. The HR option refers to HTML title types (H1, H2, H3, etc.) . The default is HR=2.
HTMLhr() creates a horizontal rule.
Since several interactive commands may be necessary to create a finished graph, invoke the HTMLplot() function when each graph is ready to output.
The RNews article The R2HTML Package has more complex examples using titles, annotations, header and footer files, and cascading style sheets.