39
votes

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.

1

1 Answers

82
votes
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