Question: I'm really interested in interrupting incremental lists of items created in Rmarkdown with RStudio, to show plots and figures, then retake the list highlighting. This is quite straightforward in Latex, but I couldn't figure out how to achieve the same result using Rmarkdown. Below is some beamer example.

```
---
title: "Sample Document"
author: "Author"
output:
 beamer_presentation:
  fonttheme: structurebold
  highlight: pygments
  incremental: yes
  keep_tex: yes
  theme: AnnArbor
  toc: true
  slide_level: 3
---

# Some stuff 1
### Some very important stuff

- More detail on stuff 1 
- More detail on stuff 1
- More detail on stuff 1

# The following chart should appear between the first and second item above

```{r, prompt=TRUE}
summary(iris[, "Sepal.Length"])

# Stuff 2
### There are other kinds of stuff?

```{r, prompt=TRUE}
summary(mtcars[, "cyl"])

```

[![enter image description here](https://i.stack.imgur.com/O0Dz2.png)](https://i.stack.imgur.com/O0Dz2.png)
[![enter image description here](https://i.stack.imgur.com/QMKCG.png)](https://i.stack.imgur.com/QMKCG.png)
[![enter image description here](https://i.stack.imgur.com/3XtpV.png)](https://i.stack.imgur.com/3XtpV.png)
[![enter image description here](https://i.stack.imgur.com/CXieu.png)](https://i.stack.imgur.com/CXieu.png)

Answer: 
first - you do not need the comma in the select, second - ensure that this is the only element with the id of status, third - simply check the $status value in each option and echo selected if it is.

```
echo "<select name = 'status' id = 'status'>
        <option value='Interested'";
           if($status == "Interested"){echo " selected";}
        echo">Interested</option>
        <option value='Not Interested' ";
           if($status == "Not Interested"){echo " selected";}
        echo">Not Interested</option>
    </select><br>";

```
Change this

```
echo "<select name = 'status', id = status>
        <option value='Interested'>Interested</option>
        <option value='Not Interested'>Not Interested</option>
    </select><br>";

```

to this

```
// Set the selected attributes based on the value of status
$interested = ($status === 'Interested') ? ' selected' : '';
$notInterested = ($interested === '') ? ' selected' : '';

echo <<< SELECT
<select name="status" id="status">
    <option$interested>Interested</option>
    <option$notInterested>Not Interested</option>
</select>
SELECT;

```

You don't need the value attribute if the value is the same as the text.

If there were more than two options, I recommend a loop like this:

```
<?php foreach ($options as $o) : ?>
    <option<?php if ($o === $optionValue) ?> selected<?php endif ?>><?= optionValue ?></option>
<?php endforeach ?>

```