我有
---
title: "test"
output: pdf_document
---
Below should be in four lines
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
test<-c("This should be in the first line \n This in the second line \n This in the third line \n This in the fourth line")
```
`r test`
在 PDFtest中顯示在 1 行中。是否可以test在 Rmarkdown中將字串編織成 4 行,還是必須在 R 中對其進行預處理?\n似乎沒有完成這項作業。
uj5u.com熱心網友回復:
你需要逃避雜技,使用\\\n.
---
title: "test"
output: pdf_document
---
Below should be in four lines
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
test<-c("This should be in the first line \\\n This in the second line \\\n This in the third line \\\n This in the fourth line")
```
`r test`

轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/402407.html
標籤:
