R to Latex packages: Coverage

March 12, 2013
By

(This article was first published on Will Lowe » R, and kindly contributed to R-bloggers)

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 mer objects from the lme4 package (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.

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.

PackageModelxtablememisctexregstargazerapsrtable
AERivregYY
tobitYYYY
basetableYY
ftableY
betaregbetaregYY
dynlmdynlmYY
ehaaftregY
phregY
weibregY
ergmergmYY
geegeeYYY (in ‘skeleton’ form)
gmmgmmY
lme4glmerModYY
lmerModYY
nlmerModYY
MASSpolrYYY
rlmYY
negbinYYY
mgcvgamY
nlmeglsYY
lmeY
nnetmultinomYY
ordinalclmYYY
sclmY
plmplmYY
pmgYY
psclhurdleYY
zeroinflYY
quantregrqY
releventrem.dyadY
rmslrmYY
robustbaselmrobYY
simexsimexYY
snalnamY
statsglmYYYYY
lmYYYYY
aovY
anovaY
prcompY
tsY
surveysvyglmYYY (in ‘skeleton’ form)
survivalcoxphYYYY
clogitYYY
survregYY
coxph.penalY
systemfitsystemfitY
termgmstergmY
ZeligzeroinflY
cloglog.netY
gamma.netY
probit.netY
logit.netY
RelogitY

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.

To leave a comment for the author, please follow the link and comment on his blog: Will Lowe » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.