rr-markdown

R Markdown two tables in one line


I want to place two tables inline in RMD file. Code as bellow produces only one table.

---
title: "2_test_RMD"
output: blastula::blastula_email
date: "2024-09-26"
---

```{r include=FALSE}
library(gt)
```



`r gt(head(mtcars)) ;gt(head(mtcars)) `

I want rmd file to show to tables in one line (not one under the other).


Solution

  • R markdown has some different ways to go about it. Here is from the Rmarkdown cookbook. Might have to include some HTML/CSS to get some space

    ---
    title: "2_test_RMD"
    output: html_document
    date: "2024-09-26"
    ---
    
    
    :::: {style="display: flex;"}
    ::: {}
    ```{r include = FALSE}
    library(gt)
    ```
    ```{r }
    gt(head(mtcars))
    ```
    :::
    ::: {} 
    ```{r}
    gt(head(mtcars))
    ```
    :::
    ::::
    

    enter image description here