Tools for making latex tables in R
On general request, a community wiki on producing latex tables in R. In this post I'll give an overview of the most commonly used packages and blogs with code for producing latex tables from less straight-forward objects. Please feel free to add any I missed, and/or give tips, hints and little tricks on how to produce nicely formatted latex tables with R.
Packages :
latex()
that creates a tex file containing the object of choice. It is pretty flexible, and can also output longtable
latex tables. There's a lot of info in the help file ?latex
Blogs and code snippets
Related questions :
I'd like to add a mention of the "brew" package. You can write a brew template file which would be LaTeX with placeholders, and then "brew" it up to create a .tex file to include or input into your LaTeX. Something like:
begin{tabular}{l l}
A & <%= fit$A %>
B & <%= fit$B %>
end{tabular}
The brew syntax can also handle loops, so you can create a table row for each row of a dataframe.
Thanks Joris for creating this question. Hopefully, it will be made into a community wiki.
The booktabs packages in latex produces nice looking tables. Here is a blog post on how to use xtable to create latex tables that use booktabs
I would also add the apsrtable
package to the mix as it produces nice looking regression tables.
Another Idea: Some of these packages (esp. memisc and apsrtable) allow easy extensions of the code to produce tables for different regression objects. One such example is the lme4 memisc code shown in the question. It might make sense to start a github repository to collect such code snippets, and over time maybe even add it to the memisc package. Any takers?
The stargazer package is another good option. It supports objects from many commonly used functions and packages (lm, glm, svyreg, survival, pscl, AER), as well as from zelig. In addition to regression tables, it can also output summary statistics for data frames, or directly output the content of data frames.
链接地址: http://www.djcxy.com/p/4242.html上一篇: 如何在不重新启动R的情况下卸载软件包?
下一篇: R制作乳胶桌子的工具