I am writing a relatively long report using R Notebook that makes use of R markdown language which combines text and code in the same document and generates html output.
I would like to be able to exclude some of the analysis (both text and R code) from showing in the final HTML. This is very useful if I want to create two versions of the report - a full/detailed version, as well as a shorter version with main graphs and conclusions.
Obviously, I can create separate Rmd file for each type of report (or comment out pieces of the report that need to be excluded for the shorter version), but I was wondering if there is a more elegant way to do it.
Something like this:
if (Version == "full_text"){
Full analysis goes here
```{r}
R code goes here (could be multiple chunks)
```
}
else {
The shorter version goes here
```{r}
R code goes here
```
}