Eric
Eric

Reputation: 1389

Unable to suppress echo with ROC in RMarkdown

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

Upvotes: 1

Views: 747

Answers (1)

Calimo
Calimo

Reputation: 7969

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)

Upvotes: 2

Related Questions