簡體   English   中英

刪除 Markdown 輸出中的換行符

[英]Remove line break in Markdown output

我想將data.table的內容打印到 R-Studio 的 Markdown 文檔中。 但是,輸出有點寬,所以我減少了字體,如下所述: Rmarkdown 中的代碼塊字體大小與 knitr 和乳膠

然而,即使將字體減小到很小,盡管有足夠的空間讓列相鄰,但換行符仍然存在。 我想知道這是如何實現的。

---
title: "mwe"
output: pdf_document
---

```
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(data.table)
dat <- data.table(id=1:5,num=31:35,text=c("a","b","c","d","here you can find some long text to artificially widen this text column and demonstrate the problem"))
```
Here is some text.

\tiny
```{r}
dat

```

輸出2 數據[5]

檢查?options並查找控制每行打印列數的參數width

---
title: "mwe"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(data.table)
dat <- data.table(id=1:5,num=31:35,text=c("a","b","c","d","here you can find some long text to artificially widen this text column and demonstrate the problem"))
```

\tiny
```{r}
dat
```

```{r}
options(width = 120)
dat
```
 

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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