There are now quite a few R packages to turn cross-tables and fitted models into nicely formatted latex. In a previous post I showed how to use one of them to display regression tables on the fly. In this post I summarise what types of R object each of the major packages can deal with.

Unsurprisingly, there’s quite some variation…

The packages I’m looking at here are: apsrtable (v0.8-8), xtable (v1.7-1), stargazer (v3.0.1), memisc (v0.96-3) and texreg (v1.22).

I should note that all of these packages also allow users to add their own latex representation for new R objects. ~~For example, here’s an addition to memisc to cover ~~ (now included in memisc). However, I couldn’t be bothered to track down all these additions, so this post only deals with what each package can do without any extra work.**mer** objects from the **lme4** package

Also, several of these packages can typeset **data.frame** and **matrix** objects too. While that can be incredibly handy, it is outside the focus of this post so I’ve left it out. Cross-tables are only just processed enough to deserve a mention. And we won’t even talk about generating HTML (well, not until the notes anyway).

Finally, I haven’t checked all of this information. The table is filled on the basis of my experience and the package documentation. If something is wrong or incomplete then please let me know in the comments.

Package | Model | xtable | memisc | texreg | stargazer | apsrtable |
---|---|---|---|---|---|---|

AER | ivreg | Y | Y | |||

tobit | Y | Y | Y | Y | ||

base | table | Y | Y | |||

ftable | Y | |||||

betareg | betareg | Y | Y | |||

dynlm | dynlm | Y | Y | |||

eha | aftreg | Y | ||||

phreg | Y | |||||

weibreg | Y | |||||

ergm | ergm | Y | Y | |||

gee | gee | Y | Y | Y (in ‘skeleton’ form) | ||

gmm | gmm | Y | ||||

lme4 | glmerMod | Y | Y | |||

lmerMod | Y | Y | ||||

nlmerMod | Y | Y | ||||

MASS | polr | Y | Y | Y | ||

rlm | Y | Y | ||||

negbin | Y | Y | Y | |||

mgcv | gam | Y | ||||

nlme | gls | Y | Y | |||

lme | Y | |||||

nnet | multinom | Y | Y | |||

ordinal | clm | Y | Y | Y | ||

sclm | Y | |||||

plm | plm | Y | Y | |||

pmg | Y | Y | ||||

pscl | hurdle | Y | Y | |||

zeroinfl | Y | Y | ||||

quantreg | rq | Y | ||||

relevent | rem.dyad | Y | ||||

rms | lrm | Y | Y | |||

robustbase | lmrob | Y | Y | |||

simex | simex | Y | Y | |||

sna | lnam | Y | ||||

stats | glm | Y | Y | Y | Y | Y |

lm | Y | Y | Y | Y | Y | |

aov | Y | |||||

anova | Y | |||||

prcomp | Y | |||||

ts | Y | |||||

survey | svyglm | Y | Y | Y (in ‘skeleton’ form) | ||

survival | coxph | Y | Y | Y | Y | |

clogit | Y | Y | Y | |||

survreg | Y | Y | ||||

coxph.penal | Y | |||||

systemfit | systemfit | Y | ||||

termgm | stergm | Y | ||||

Zelig | zeroinfl | Y | ||||

cloglog.net | Y | |||||

gamma.net | Y | |||||

probit.net | Y | |||||

logit.net | Y | |||||

Relogit | Y |

**Notes**

In case you are curious, a first version of this table was generated using the **print.xtable** function of the xtable package with **type=html** before being adjusted in place. If these posts haven’t given you the idea yet: I detest doing this sort of thing by hand.

Liviu (in the comments) also mentions the estout package. I’ve never used it, but apparently it deals with lm and plm models and is modeled after a Stata command of the same name.

## Z

The version of “memisc” that you discuss has many more methods for getSummary() compared to previous versions, namely: aftreg, betareg, clm, coxph, expcoef, expcoef.glm, hurdle, ivreg, mer, multinom, phreg, polr, simex, survreg, tobit, weibreg.

Some further objects such as dynlm or negbin (and possibly more) are handled reasonably well by inheritance. This may also be true for some of the other packages (which I don’t know as well as memisc).

## Will

Excellent! Thanks for letting me know. I’ll fix the list later today. (I use memisc for mostly for its ftable coverage, so I hadn’t explored the rest.)

## Tal Galili

What a GREAT list, thank you for writing this up!

## Fr.

This is very useful, excellent job. Thanks.

## Steve Powell

Very useful, thanks!

## Geoffrey Knauth

Thanks!

## Chris Beeley

Dude, you rock. Thanks!

## Liviu

Excellent list. Please keep it up-to-date as possible.

I think you could add here package ‘estout’, inspired by the estout package for Stata. It has a strange R-unlike syntax, though.

## Jose Gama

Package Rgnuplot can save 2D and 3D plots as LaTeX by using gnuplot as a plot engine

Rgnuplot: Rgnuplot, R interface for gnuplot

http://cran.r-project.org/web/packages/Rgnuplot/index.html