0
votes

I'm trying to do some hirarchical numbering on Rmarkdown which is usually easy, but I'm facing some problem that I'm not sure if it's a bug or if I am missing something.

If I run the following Inside a Rmarkdown (even here on github) the second numbering (2. number2) becomes a chunk of code instead of continuing the previous count which was expected to be ii, and I can't figure out why or how to fix it.

1. RR
    1. number1

```{r}
print(head(iris))
```

    2. number2


```{r}
print(head(iris))
```

Output

[Edit: added output image]

1
I am not sure based on this why or what is really going on, but my experience with 'tainted' chunks i that you may need to add two spaces after '```' as well as a hard returnsconfluentus
Added an output image, spaces doesn't seems to fix itOchetski
is yoru concern that the print(head(iris)) showssconfluentus
No, it was just an example. The problem is that the 2. Number2 is inside of a output like instead of continuing the previous numberingOchetski
You mean the box around the 2.sadadas?sconfluentus

1 Answers

0
votes

Try turning echo off so you do not get the code boxes around the output, and instead of using print, try using the package knitr and calling cable, it makes a nicely formatted table which will not interfere with your text and the echo kills the printing of the code box

1. RR
```{r echo=FALSE}
knitr::kable(head(iris))
```

2. major stuff
  i) some sub-stuff
     A. more-sub stuff
     B. more-sub stuff

```{r echo=FALSE}
knitr::kable(head(iris))
```

enter image description here