Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

r - preventing a chunk run in rmarkdown

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.

question from:https://stackoverflow.com/questions/25837990/preventing-a-chunk-run-in-rmarkdown

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...