簡體   English   中英

使用R markdown和knitr時避免文字溢出到邊距

[英]Avoid spilling of text to margin when using R markdown and knitr

使用rmarkdownknitr生成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() 函數使用widthstrict.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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM