Search code examples
rshinyflexdashboard

Flexdashboard columns - text not showing up


In my flexdashboard I have a column with a note, then a table, and I would like to add one more note below the table. But I am struggling to get the second note to show up. I can make a new header there but I really just want another sentence that shows up without a new header. Here is some simple code to illustrate. Thanks!

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
runtime: shiny

---

```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(shiny)
library(rhandsontable)
    
df <- tibble(
      `Col 1` = seq(1,24,1), `Col 2` = " ")
```

Column {data-width=650}
-----------------------------------------------------------------------

### Table

I can write a note here


```{r}

  output$table_exer <- renderRHandsontable({
    rhandsontable(df, rowHeaders = NULL) 
  })

  rHandsontableOutput("table_exer")
  
  
```

But I also want a note here


Column {data-width=350}
-----------------------------------------------------------------------

### Chart B

```{r}

```

### Chart C

```{r}

```

Solution

  • very simple, wrap your table inside fluidRow, like this:

    ```{r}
    
    output$table_exer <- renderRHandsontable({
    rhandsontable(df, rowHeaders = NULL) 
    })
    
    fluidRow(rHandsontableOutput("table_exer"))
    ```
    

    To make the margin and spacing look nicer, we can also do following:

    ```{r}
    
    output$table_exer <- renderRHandsontable({
    rhandsontable(df, rowHeaders = NULL) 
    })
    
    column(12, fluidRow(rHandsontableOutput("table_exer")))
    br()
    ```
    

    enter image description here