Resizing a stargazer table in Knitr

心不动则不痛 提交于 2019-11-30 19:54:01

问题


I've put together a document using knitr and while most of the document looks fine, there's one regression table that's too wide to fit on a page without some alteration.

The regression table is generated using stargazer, and is quite wide.

I've attempted to resize the entire chunk as follows:

{r, echo=FALSE, resize.width=10, results='asis'}

stargazer( table...)

but have had no luck in generating resized output. Is there something that I'm doing wrong, is it not possible to resize these stargazer tables via chunk options?

Thanks!


回答1:


You can use a .css file to resize the output.

in the YAML add :

---
output: 
html_document:
    css: custom.css
---

and in a custom.css file you can put :

table {
  width: 100%;  
} 

it's often easier to place the custom.css in the same folder, and note that your final output will still be self-contained.



来源:https://stackoverflow.com/questions/30417073/resizing-a-stargazer-table-in-knitr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!