preventing a chunk run in rmarkdown

RKnitrR Markdown

R Problem Overview


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.

R Solutions


Solution 1 - R

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSHRramView Question on Stackoverflow
Solution 1 - RHernando CasasView Answer on Stackoverflow