[R] printing tabular data nicely

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Jun 4 01:42:29 CEST 2004


Marcus Davy wrote:
> Hi,
> If you choose to use LaTeX and xtable, you can also enhance the visual
> presentation
> of the output tables using the booktab LaTeX package. Have a look at:
> 
> http://www.ecs.soton.ac.uk/~srg/softwaretools/document/start/booktabs.pdf
> 
> You can change the horizontal line tags \hline to \toprule, \midrule,
> and \bottomrule, at your discretion. 
> There was also a recent thread about rownames quirks with xtable:
> 
> http://tolstoy.newcastle.edu.au/R/help/04/05/0678.html
> 
> 
> marcus

The LaTeX ctable style, which uses booktab I believe, is slightly more 
up to date and has more options.  The latex function in the Hmisc 
package has a ctable option as well as a booktabs option.

Frank Harrell

> 
> 
> 
> 
>>>>Duncan Murdoch <dmurdoch at pair.com> 4/06/2004 7:06:14 AM >>>
> 
> On Thu, 03 Jun 2004 10:19:26 -0700, wwsprague at ucdavis.edu wrote :
> 
> 
>>Hi R-heplers,
>>
>>I would like to print various matrices, dataframes, tables, etc to 
>>files, preferably nicely formatted postscript for import into papers.
> 
> 
>>Is there a way to do this?
>>
>>I know ?cat, ?writeLines, ?format, ?paste.  But I am not sure of a
> 
> good 
> 
>>combination of these in order to get a nice looking table of
> 
> information.
> 
>>Any ideas?  I guess I want (almost) publication ready output, just
> 
> like 
> 
>>you get for "plot"...
>>
>>(I *don't* want to print to the console, btw)
> 
> 
> As Sundar said, xtable is probably what you want.  You may also
> benefit from the fairly new "addmargins" function.
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> ______________________________________________________
> 
> The contents of this e-mail are privileged and/or confidenti...{{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list