Ren*_*rop 11 r r-markdown
如何用rmarkdown显示我的代码块的行号?
```{r}
x <- 1:10
y <- x^2
plot(x,y)
```
Run Code Online (Sandbox Code Playgroud)
我希望回声是这样的
1 x <- 1:10
2 y <- x^2
3 plot(x,y)
Run Code Online (Sandbox Code Playgroud)
最好像在Github上一样......
很高兴能得到任何帮助
小智 10
您可以生成两个代码块:一个用于演示,另一个用于执行.
---
output:
pdf_document:
highlight: haddock
---
```{#numCode .R .numberLines}
x <- 1:10
y <- x^2
plot(x,y)
```
```{r results='asis', echo=FALSE}
x <- 1:10
y <- x^2
plot(x,y)
```
Run Code Online (Sandbox Code Playgroud)
注意:如果将pdf_document替换为html_document,则必须提供元数据"highlight".