[R] How good is R at making publication quality tables?

Erik Iverson eriki at ccbr.umn.edu
Wed Mar 17 16:25:03 CET 2010



Paul Miller wrote:
> Hello Everyone,
> 
> I have just started learning R and am in the process of figuring out
> what it can and can't do. I must say I am very impressed with R so
> far and am amazed that something this good can actually be free.
> 
> Recently, I finished reading R for SAS and SPSS Users and have begun
> reading SAS and R and Data Manipulation with R. Based on what I've
> read in these books and elsewhere, I get the impression that R is
> very good at drawing high quality graphs but maybe not so good at
> creating nice looking tables of the sort I'm used to getting through
> SAS ODS.

You're really only limited by your imagination here.  I have written 
several custom table functions to output LaTeX, but you can output 
whatever you like (HTML, plain-text, org-mode files...), you're in 
complete control with R.

I can second the Hmisc package though.  I often use a combination of 
summary.formula and the latex function to output really nice looking 
tables that get put into a long PDF report for a study.

I can say that both of these functions, summary.formula and latex, in 
Hmisc have a LOT of arguments, and almost every time I said "I wish it 
looked a little different", there was an option to control it.

Specifically, I found the options:

exclude1, long, longtable, combine, test,

do be very useful.  I often make tables by some treatment group, so all 
these are using method = "reverse" to accomplish that.

And if you don't like the output, latex.summary.formula.reverse is a 
good function to make your own version of, to output exactly what you 
want.  I have a local copy that augments the tables that contain 
unadjusted p-values with adjusted p-values from a model.

But apart from Hmisc, just realize that with R you have a nice 
programming language to produce any type of output you want, you're not 
limited to what someone else gave you.

--Erik



More information about the R-help mailing list