调整R Markdown HTML输出的输出宽度 [英] Adjust the output width of R Markdown HTML output
问题描述
我正在生成HTML输出,但是R代码输出的输出宽度有问题.
I am producing an HTML output but I am having issues with the output width of R code output.
我能够毫不费力地调整图形宽度,但是当我尝试编写数据表或加载因子时,R以固定宽度输出,该宽度仅为屏幕宽度的三分之一.这导致表中的列被拆分,而不是单个表中显示的所有列都被拆分.
I'm able to adjust the figure width with no difficulty but when I try to write a data table or the factor loadings, R is outputting at a fixed width which is only about a third of my screen width. This results in the columns of the table being split up rather than all of the columns displayed in a single table.
以下是可重现的示例:
---
output: html_document
---
# Title
```{r echo = FALSE, fig.width=16, fig.height=6}
x = matrix(rnorm(100),ncol=10)
x
plot(x)
```
推荐答案
在文档开始处添加以下内容:
Add this at the start of your document:
```{r set-options, echo=FALSE, cache=FALSE}
options(width = SOME-REALLY-BIG-VALUE)
```
很显然,将SOME-REALLY-BIG-VALUE替换为一个数字.但是,您真的要进行所有水平滚动吗?
Obviously, replace SOME-REALLY-BIG-VALUE with a number. But do you really want to do all that horizontal scrolling?
您的输出可能被包裹在大约80个字符左右的位置.
Your output is probably being wrapped somewhere around 80 characters or so.
这篇关于调整R Markdown HTML输出的输出宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!