3

我使用 knitr 整理了一份文档,虽然大部分文档看起来都不错,但有一个回归表太宽,无法在没有任何改动的情况下放在页面上。

回归表是使用 stargazer 生成的,并且非常宽。

我试图调整整个块的大小,如下所示:

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

stargazer( table...)

但在生成调整大小的输出方面没有运气。有什么我做错了,不能通过块选项调整这些观星者表的大小吗?

谢谢!

4

2 回答 2

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.

于 2015-09-05T08:17:36.933 回答
1

您可以操纵 stargazer 的选项来调整 stargazer 表的大小。对于 R markdown 的 PDF 输出,请尝试以下操作:

stargazer(model_1, model_2, model_3, model_4, model_5,
          type = 'latex',
 
          header=FALSE, # to get rid of r package output text

          single.row = TRUE, # to put coefficients and standard errors on same line

          no.space = TRUE, # to remove the spaces after each line of coefficients

          column.sep.width = "3pt", # to reduce column width

          font.size = "small" # to make font size smaller

)
于 2020-10-09T09:42:29.800 回答