[R] Writing a tabel in LaTeX-format

Thomas Lumley thomas at biostat.washington.edu
Thu Sep 7 18:05:01 CEST 2000


On Thu, 7 Sep 2000, BXC (Bendix Carstensen) wrote:

> I have a vague recollection of seeing a R-function
> that will output a table or matix in a format suitable
> for the tabular enviroment in LaTeX.
> 
> But I cannot find it. Any hints?


You can do most of this with write.table
I use 
 write.table(x,quote=FALSE,sep=" & ",eol="\\\\ \n",row.names=FALSE)
or if I have negative numbers and want a proper minus sign, sep= "$ & $",
eol="$ \\\\ \n$"

Often I preprocess x with zapsmall() and format() to get rid of scientific
notation. It would be nice to have an extension to do all this properly,
and to write eg 3.5\times 10^{-5} rather than 3.5e-5.

Some of the code I have seen for latex tables in S produces very ugly
tables with lines everywhere (rather like some of the examples in the
LaTeX book, but that at least has the excuse of needing to show off the
capabilities of the program).


	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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