Share
Share

Reputation: 505

How to suppress the code but have the plots displayed in R markdown?

I have a very long plot code written out in R markdown. I do not want the code to be displayed, but I want to the graphs to be displayed.

I used this advice and have this in my R chunk

```{r, include=FALSE, results="hide", fig.width=8, fig.height=6}
x = c(1:10)
y = c(40:50)
plot(x~y)
````

However, this simply does not give any output on the knitted file. Any suggestions?

Upvotes: 3

Views: 11772

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226731

Use echo=FALSE, neither results="hide" nor include=FALSE in your chunk options (I think the latter is your real problem). (As @markdly comments below, that means {r, echo=FALSE, fig.width=8, fig.height=6} are the options you want to use.)

Upvotes: 11

Related Questions