Search code examples
rmarkdownr-markdownflexdashboard

R Markdown flexdashboard - Change placement of data table


I would like my R Markdown output all the way at the left once I knit to HTML instead it to be centered in the middle. I can't seem to find how to do such a thing.

Below is a reproducible example:

---
title: "Untitled"
output:
  html_document:
    df_print: paged
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
```

```{r, echo = FALSE}
DT::datatable(iris)
```

Solution

  • Edit: add more info

    In your yaml header, the html_document output sits before flex_dashboard, so html_document is the default output when you Knit.

    You can select Knit to flex_dashboard in the knit dropdown menu.


    I think you need this: layout control of flex_dashboard

    In your case, try this:

    ---
    title: "Untitled"
    output:
      flexdashboard::flex_dashboard:
        orientation: columns
        vertical_layout: fill
      html_document:
        df_print: paged
    ---
    
    ```{r setup, include=FALSE}
    library(flexdashboard)
    ```
    
    Column{data-width=50}
    ---------------------------------
    
    ### Chart 1
    
    ```{r, echo = FALSE}
    DT::datatable(iris)
    ```
    
    Column{data-width=50}
    ---------------------------------
    
    ### Chart 2
    
    ```{r}
    
    ```