Is there a way to continue a list with an indented bullet point following an R chunk in Rmarkdown (with HTML output)? When I try this:
## R Markdown
1. First item in list
+ run this R code:
```{r cars}
# code...
```
+ Continuing a list at the same level after an R chunk works.
2. Second item
```{r}
# example code
```
+ Continuing a list at an increased level of indentation doesn't work.
I get this:
Text can be indented two ways depending on if the indent is within a list or not. Within a list, four spaces at the begin of the line indicates the text is to be indented one nesting level. Use four additional spaces for each additional nesting level. To indent text which is not in a list, use a block quote.
To make a bulleted-list in R Markdown , a series of lines are prefaced with an asterisk in exactly the manner as in a plain-text email (See Figure 1).
Solution. Asterisks can be used to add bullet points to an . rmd file.
You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS). There are a large number of chunk options in knitr documented at https://yihui.name/knitr/options.
You should indent any code block relative to the list item it belongs to, i.e. both the first and the second code block:
## R Markdown
1. First item in list
+ run this R code:
```{r cars}
# code...
```
and look at the output
+ Continuing a list at the same level after an R chunk works.
2. Second item
```{r}
# example code
```
+ Continuing a list at an increased level of indentation does work.
this way continuing the list item after the code block works in addition to handling new list items properly:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With