在Knitr中调整观星台的大小 [英] Resizing a stargazer table in Knitr

查看:72
本文介绍了在Knitr中调整观星台的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用knitr整理了一个文档,尽管大部分文档看起来都不错,但其中一个回归表的宽度太大,无法容纳页面而无需进行任何更改.

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.

回归表是使用stargazer生成的,非常宽.

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?

谢谢!

推荐答案

您可以使用.css文件来调整输出大小.

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

在YAML中添加:

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

,并且在custom.css文件中,您可以放置​​:

and in a custom.css file you can put :

table {
  width: 100%;  
} 

通常将custom.css放在同一文件夹中会更容易,请注意,最终输出仍将是独立的.

这篇关于在Knitr中调整观星台的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆