APSRtable: Getting Tables from R to \( \LaTeX \)

December 5, 2012

[This article was first published on is.R(), and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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”))

To leave a comment for the author, please follow the link and comment on their blog: is.R().

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)