Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 745
Ash Avatar asked Nov 20 '25 09:11

Ash


1 Answers

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

like image 102
Ben Bolker Avatar answered Nov 22 '25 22:11

Ben Bolker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!