Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

indented bullet point after R chunk in Rmarkdown

Tags:

r

r-markdown

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:
enter image description here

like image 270
filups21 Avatar asked Jun 04 '18 11:06

filups21


People also ask

How do you add an indent in Rmarkdown?

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.

How do you make bullet points in R markdown?

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).

What symbol can add bullet points in R markdown?

Solution. Asterisks can be used to add bullet points to an . rmd file.

How do you add r chunk in R markdown?

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.


1 Answers

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:

enter image description here

like image 71
Ralf Stubner Avatar answered Sep 20 '22 14:09

Ralf Stubner