1

I'm looking for a way to evaluate code in a incremental way in R markdown presentation. I don't need to use any specific format - it can be anything that works and is flexible (rpres, ion, revealjs, etc.)

I'll use these presentation in class for my students and would like to make them type code in their R Console first and then compare our outputs.

So far I came up with one solution using revealjs with slide_level header

---
title: "Test presentation"
output: revealjs::revealjs_presentation
slide_level: 2
---

# Level 1 horizontal main slide

Some text 

## Level 2 vertical slide with R Code

```{r eval=FALSE}
summary(cars)
```

## Level 2 vertical slide with R output

```{r echo=FALSE}
summary(cars)
```

Anything easier and less time consuming would be great.

blazej
  • 1,678
  • 3
  • 19
  • 41

1 Answers1

0

I know the question is a bit old but you can use the incremental option for example with ioslides. That way you don't have to change slide but you can print step by step first the text then the code and then the result.

example code:

---
title: "Test presentation"
output:
  ioslides_presentation:
    incremental: yes
---

## Slide 1

- Some text 

- Level 2 just the code
    ```{r eval=FALSE}
    summary(cars)
    ```

- Level 2 just the output
    ```{r echo=FALSE}
    summary(cars)
    ```
Beefburger
  • 11
  • 3