R chunk Hide results

Hi

I would like to hide a result of a chunk and just show a code in R Markdown. This is works okay but not if I have a code to plot a graph. I suppose I can comment the line for executing the plot but thought if there are another option I can specify in the chunk to do this. Many Thanks

Use the chunk option fig.keep="none". For example, this chunk will assign the a variable, run the plotting code, but then not include the plot in the rendered document.

```{r pressure, fig.keep='none'}
a <- 1
plot(pressure)
```

There are a lot of chunk options. You can look through them on knitr's documentation site.

1 Like

Thanks very much for your help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.