# APSRtable: Getting Tables from R to $$\LaTeX$$

December 5, 2012
By

(This article was first published on is.R(), and kindly contributed to R-bloggers)

Oftentimes you might be writing in LaTeX and trying to push your results from R into your .tex file. This, at times, can be very frustrating. Luckily, there’s apsrtable, an R package that automatically produces the LaTeX code for your  R model objects. The code below is relatively self-explanatory, and the package manual will help. To get the tables to compile in TeX, use \usepackage{dcolumn}

After a simple call of:

apsrtable( models you want tables of, OPTS) you can copy/paste the LaTeX  code right from the R console into your TeX editor. Enjoy:

One of the options to improve the tables is to specify the names for the coefficients in your model; you can also specify the threshold for where stars are displayed:
apsrtable(Model.1, Model.2, Model.3, Model.4, lev=.30,
model.names=c(“Model 1” , “Second Try”, “Model 3”, “My Fourth Model”),
coef.names=c(“Intercept”, “Some Variables”, “That Might”, “Be Of”, “Interest to You”))