Unable to suppress echo with ROC in RMarkdown

706 views Asked by At

I am not able to suppress the echo of roc command (pROC package) despite setting echo to FALSE in the code chunk. the roc commands outputs "call" and "data" lines to the pdf. Can anyone help me figure out how to turn it off?

---
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)
```

enter image description here

1

There are 1 answers

1
Calimo On BEST ANSWER

Note that echo only effects the printing of the source code according to knitr documentation, not the output of R commands:

echo: (TRUE; logical or numeric) whether to include R source code in the output file;

What you really want is results='hide' instead of '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)