【发布时间】:2012-03-22 06:45:43
【问题描述】:
我正在使用带有外部代码选项的 knitr 包。有没有一种方法可以让我跳过一个块中的一行被读取?例如:
## @knitr chunk1
a <- 1:100
## This comment should not appear
## @knitr chunk2
print(a[1:12])
在上面的示例中,我希望第 3 行不会出现在最终的 *.pdf 中。非常感谢任何提示。
【问题讨论】:
我正在使用带有外部代码选项的 knitr 包。有没有一种方法可以让我跳过一个块中的一行被读取?例如:
## @knitr chunk1
a <- 1:100
## This comment should not appear
## @knitr chunk2
print(a[1:12])
在上面的示例中,我希望第 3 行不会出现在最终的 *.pdf 中。非常感谢任何提示。
【问题讨论】:
两种方法:
<<chunk1, echo=-2>>=,这意味着您要从output 中排除第二个表达式;## @knitr go-away),或者根本没有标签 (## @knitr)【讨论】: