[英]Avoid spilling of text to margin when using R markdown and knitr
使用rmarkdown
和knitr
生成pdf文件時,如何避免R
控制台輸出的文本溢出到頁邊距? 例如,
---
title: "Illustration"
author: "Temp"
date: "Monday, April 06, 2015"
output: pdf_document
---
Spilling of R output.
```{r}
library("tm")
data("acq")
str(acq)
```
我發現解決這個問題的最一致的方法是對str()
函數使用width
和strict.width
選項。 width
選項指定要使用的頁面寬度,並且應該繼承自width的active options()設置。 但是,我並不總是發現這種一致。 strict.width
允許您控制多余文本的處理方式(剪切, strict.width
)。
---
title: "Illustration"
author: "Temp"
date: "Monday, April 06, 2015"
output: pdf_document
---
Spilling of R output.
```{r}
library("tm")
data("acq")
str(acq,width=80,strict.width="cut")
```
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.