如何在 R Markdown 中调整 Stargazer 生成的表的大小? [英] How to resize tables generated by Stargazer in R Markdown?
问题描述
我在代码块中包含了resize.height=0.5,resize.width=0.5
,但仍然无法调整stargazer生成的表格的大小.谁能告诉我为什么?
I included resize.height=0.5,resize.width=0.5
in the code chunk, but still can't resize the table generated by stargazer. Can anyone tell me why?
我的代码块选项如下所示:echo=FALSE,warning=FALSE,results='asis',resize.height=0.5,resize.width=0.5}
My code chunk options look like this:
echo=FALSE,warning=FALSE,results='asis',resize.height=0.5,resize.width=0.5}
观星者代码是这样的:
stargazer(did.student,student.control.kmt,student.control.neu,student.control.dpp,header = FALSE,
title="DD Model",
covariate.labels = c("Treatment","group","Treatment*group"),
dep.var.labels = "attitude",
column.labels = c("","party1","Independent","party2"),
label = "DiD-students")
非常感谢您的帮助!
--忘了提 - 我在桌子上使用投影仪.
-- Forgot to mention - I'm using beamer with the table.
推荐答案
我自己解决了这个问题:
I kind of solve the problem myself:
用stargazer调整表格大小,你可以改变字体大小font.size=
,使Stargazer单行single.row = TRUE
并改变之间的空间stargazer()
中的列 column.sep.width = "1pt"
.
To adjust table size with stargazer, you can change the font size font.size=
, make the Stargazer single row single.row = TRUE
and change the space between columns column.sep.width = "1pt"
in stargazer()
.
虽然这里的链接 建议使用 print(stargazer(),scalebox='0.7')
,它对我不起作用,可能是因为我将 Markdown 与 Beamer 一起使用,但我不确定.仍然希望在这方面做出更多贡献.
Though the link here suggests using print(stargazer(),scalebox='0.7')
, it doesn't work for me perhaps because I'm using Markdown with Beamer, but I'm not sure. Would still love to have more contribution on this.
我希望得到一个更直接的答案,但这是有效的!
I was hoping for a more straightforward answer, but this works!
这篇关于如何在 R Markdown 中调整 Stargazer 生成的表的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!