无法在 RMarkdown 中使用 ROC 抑制回声
Unable to suppress echo with ROC in RMarkdown
尽管在代码块中将 echo 设置为 FALSE,但我无法抑制 roc 命令(pROC 包)的回显。 roc 命令将 "call" 和 "data" 行输出到 pdf。谁能帮我弄清楚如何关闭它?
---
title: "ROC echo"
output: pdf_document
---
```{r,echo=F,warning=F,message=F, comment=NA, results='asis',fig.width=10}
library(pROC)
data(iris)
iris$setosa <- ifelse(iris$Species=="setosa","setosa","not setosa")
iris.roc <- roc(setosa ~ Sepal.Width,data =iris)
plot.roc(iris.roc)
```
注意echo
只影响根据knitr documentation打印源代码,不影响R命令的输出:
echo
: (TRUE; logical or numeric) whether to include R source code in
the output file;
你真正想要的是 results='hide'
而不是 'asis'
:
results
: ('markup'; character) takes these possible values
- (...)
asis
: output as-is, i.e., write raw results from R into the output document
- (...)
hide
hide results; this option only applies to normal R output (not warnings, messages or errors)
尽管在代码块中将 echo 设置为 FALSE,但我无法抑制 roc 命令(pROC 包)的回显。 roc 命令将 "call" 和 "data" 行输出到 pdf。谁能帮我弄清楚如何关闭它?
---
title: "ROC echo"
output: pdf_document
---
```{r,echo=F,warning=F,message=F, comment=NA, results='asis',fig.width=10}
library(pROC)
data(iris)
iris$setosa <- ifelse(iris$Species=="setosa","setosa","not setosa")
iris.roc <- roc(setosa ~ Sepal.Width,data =iris)
plot.roc(iris.roc)
```
注意echo
只影响根据knitr documentation打印源代码,不影响R命令的输出:
echo
: (TRUE; logical or numeric) whether to include R source code in the output file;
你真正想要的是 results='hide'
而不是 'asis'
:
results
: ('markup'; character) takes these possible values
- (...)
asis
: output as-is, i.e., write raw results from R into the output document- (...)
hide
hide results; this option only applies to normal R output (not warnings, messages or errors)