当我对文档进行purl/tangle以将R块提取到脚本中时,有什么方法可以:
eval=F(或者我可以定义一个chunk hook/option include=F)?例如,假设我有以下Rmd:
```{r setup, echo=F}
library(MASS)
```
First, we perform the setup (assume for some reason I need to evaluate `setup`
silently before I wish to display the chunk to the user, hence the repetition)
```{r setup, eval=F}
```
Here's the function I've been explaining:
```{r function}
plus <- function (a, b) a + b
```
And here's an example of its use:
```{r example}
plus(1, 2)
```
Run Code Online (Sandbox Code Playgroud)
纠结的脚本看起来像这样:
## @knitr setup, echo=F …Run Code Online (Sandbox Code Playgroud) 我希望能够使用knitr/rmarkdown生成一个文档,将所有输出保持在一起,但将代码保留到最后,理想情况下作为引用的脚注(即可以查找每个图形或输出的代码)在附录中使用脚注).这可能吗?