Search code examples
rshinyflexdashboard

Blank elements and issues deploying Shiny/Flexdashboard with R Studio


I am working on a simple dashboard with using R, Shiny, Flexdashboard and Leaflet. The code itself seems to work fine. However I am facing some issues to deploy it.

When I run/Knit the document for the first time everytyhing seems ok, but if I try to publish it I receive this message when I hit the 'Publish' button above the rendered document:

'Only rendered R Markdown documents can be published to RPubs. To publish this document, click Knit to render it, then click the Publish button above the rendered document'

Then, if I reload the page or Knit the document again without make any change, the tables and the maps disappears.

Initially, I thought it was something with Leaflet, but I got the same behavior with this minimal and reproducible example both in R Studio and R Studio Cloud.

---
title: "Example"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    runtime: shiny
---

```{r }
library(flexdashboard)
library(shiny)
library(DT)

# OPERAÇÃO POR BAIRROS
link = "https://docs.google.com/spreadsheets/d/e/2PACX-1vS3cj3PhVm-2F-CiEJOE8O1YIIU6t7os_wDDrACFne39ZRUvxLKdV_MKZNzD6xTG0hoI5ZroHpxyIzV/pub?output=csv"
df_op = read.csv(link)
  
```

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

### Table

```{r table}

df_table = reactive({
   df_op
})

DT::renderDataTable(df_table())
```

Solution

  • To solve the blank element issue, the line runtime:shiny must be written from the first column, just as described bellow.

    title: "Example"
    output:
      flexdashboard::flex_dashboard:
        orientation: columns
    runtime: shiny