I couldn't find a way to get this in both document types. So if you want to create PDFs, go for the first example and do not use <!-- -->
. In HTML you can leave both comment characters inside the document.
What about this for PDF
title: "Untitled"
author: "Mario Dejung <[email protected]>"
date: "28 Sep 2016"
output: pdf_document
header-includes: \usepackage{comment}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
\begin{comment}
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
\end{comment}
And this for HTML
---
title: "Untitled"
author: "Mario Dejung <[email protected]>"
date: "28 Sep 2016"
output: html_document
header-includes: \usepackage{comment}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
<!--
\begin{comment}
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
\end{comment}
-->
knitr::opts_chunk$set(eval=FALSE)
to set eval=FALSE for all chunks after the command ; I have no idea how to do that easily for the text. – scoachunk$set
, and in fact I use it to not evaluate my code not needed and save time. – Simone Marini<!---text--->
– Daniel Winkler