When creating a beamer presentation from R Markdown (with R studio), I sometimes need to create extra slides that contain additional information.
I’m wondering how do I create a new slide only if a condition is met?
---
title: "Untitled"
output: beamer_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## R Markdown
Some Text
```{r, results='asis'}
if(TRUE){
cat("## Conditional Slide")
cat('\n')
cat("First Conditional Slide")
}
```
```{r, results='asis'}
if(FALSE){
cat("## Conditional Slide")
cat('\n')
cat("Second Conditional Slide")
}
```