9

Possible Duplicate:
How can I use a table generated by R in LaTeX?

I use a lot of tables from R, and I find it cumbersome and very slow to type the "&" and "\" etc. to get the tables translated into LaTeX. Is there some way to have a table like that below automatically formatted for LaTeX?

      Df Deviance Resid. Df Resid. Dev
NULL                      74    1233.55
inflat  1     4.13        73    1229.42
inc     1   907.24        72     322.18
Analysis of Deviance Table

       Df Deviance Resid. Df Resid. Dev
NULL                      59    1450.07
inflat  1    99.44        58    1350.63
inc     1   861.93        57     488.69
Analysis of Deviance Table

       Df Deviance Resid. Df Resid. Dev
NULL                     158    28963.3
inflat  1   3302.4       157    25660.9
inc     1  23996.2       156     1664.8
2

Using the XTable package as Alan commented. There's a good set of example tables as part of the CRAN XTable vignette. You may also want to look at the descr package which has helper function to produce some other usefull tables.

Xtable can either just produce the latex code that you can copy/paste into a tex file, or you can use it within a sweave document to produce the tables automatically as part of your analysis.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.