将注释存储在markdown文件中的语法是什么,例如文件顶部的CVS $ Id $注释?降价项目我什么都没发现.
是否可以注释掉包含多个块(例如:4-5)的Rmd文件的一部分?常规HTML注释无效。
---
title: "Untitled"
author: "author"
date: "5 August 2017"
output: pdf_document
---
```{r}
print(123)
```
```{r}
2**2
```
<!--
# Comment section starts
This text is not visible in the output.
```{r}
a <- 3*4
a
```
This text not be visible in the output.
# Comment section ends
-->
```{r}
print(1)
```
Run Code Online (Sandbox Code Playgroud)
过去,我记得在SO帖子的某处读到它的目标是下一版knitr。
更新:我并不是要eval=FALSE在每个块中使用该解决方案,因为我也需要注释掉块之间的文本。另外,我正在寻找一种优雅的方式来做到这一点。
上面的代码输出pdf输出,如下所示:
令人惊讶的是,它有效。但是相同的HTML注释(<!-- -->)在另一个原始Rmarkdown脚本中不起作用。仅在包含以下要跳过执行的代码的代码段之后,才实现跳过Rmd文件的一部分。
<!--
# Comment section starts
```{r, include=FALSE}
knitr::opts_chunk$set(eval= FALSE)
```
This …Run Code Online (Sandbox Code Playgroud) 该建议在注释.Rmd文档中使用HTML注释<!-- comment here -->是不够的.我想评论一下我的文档中包含内联评估的部分:
I haven't defined `x` yet.
<!-- So when I say that `x` is `r x` in the text, I'd like to comment it out -->
Run Code Online (Sandbox Code Playgroud)
编织失败:
# |.................................................................| 100%
# inline R code fragments
#
#
#
#
# processing file: test.Rmd
# Quitting from lines 2-3 (test.Rmd)
# Error in eval(expr, envir, enclos) : object 'x' not found
# Calls: <Anonymous> ... in_dir -> inline_exec -> withVisible -> eval …Run Code Online (Sandbox Code Playgroud)