preventing a chunk run in rmarkdown

SHRram picture SHRram · Sep 14, 2014 · Viewed 40.7k times · Source

I am using Rmarkdown and Knitr using Rstudio.

The following both print script and output to html.

```{r}
summary(cars)
```

However the following will only print the output, that is embedded plot.

```{r, echo=FALSE}
plot(cars)
```

I have situation different than above, I want to present the script but should not run in html as this will take very long time (hours if not days) to run. So I just did was put comment sign.

```{r}
#summary(cars)
```

But I need a better way to do this - Is there any better way presenting script without running it.

Answer

Hernando Casas picture Hernando Casas · Sep 15, 2014
eval = FALSE

Checkout The R Markdown Cheat Sheet http://blog.rstudio.org/2014/08/01/the-r-markdown-cheat-sheet/

It summarizes the options for code chunks