1

i'm trying to make a loop with 2 column in rmarkdown html :

  • two column in each chapter
  • chapters made insideR ,results='asis' loop

i tried to combine multi column and loop and it's not working
i'm tryng some frankenstein code with raw html in asis chunk and it's not working

---
title: "test"
output: html_document
---


```{r , echo=FALSE , results='asis'}

for (i in 1:2){
    cat(' \n# titre ', i , " \n ") 
cat("htmltools::HTML('<div style=\"display: flex;\">')" , " \n ")  
cat("blabla col 1" , ' \n')
cat("htmltools::HTML('</div>')" , " \n ")
cat("htmltools::HTML('<div>')" , " \n ")
cat("blabla col 2" , ' \n')
cat("htmltools::HTML('</div>')" , " \n ")
cat("htmltools::HTML('</div>')" , " \n ")
}
  
```
s.brunel
  • 1,003
  • 10
  • 24
  • I'm not familiar with `htmltools::HTML` but I suspect you need to either call `cat` with HTML code or do something with `htmltools::HTML` outside of `cat` or at least outside of `cat`'s quotes? – Fons MA Jan 27 '21 at 11:45
  • i tried both and they are not working `cat('
    ')` and `htmltools::HTML('
    ')`
    – s.brunel Jan 27 '21 at 12:35

0 Answers0