Search code examples
rshinyflexdashboard

FlexDashboard with Shiny won't Render Graphs


I am making a flexdashboard in RStudio with some shiny interactivity. When I render it after making edits, everything shows up fine. But if I rerun the graphs & the table will not show up (all the titles/formatting/drop-down menus work fine, but the spots for the graphs remain empty). There's no error message, just blank. The same issue when opening in the browser, but that doesn't even work the first time. I've attached a similar simplified dashboard that gives me the same issue.

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

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

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

### Chart A

```{r}
renderPlot( {
p <-  ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point()

print(p)
})
```

I updated RStudio and updated all the packages I am using. It still won't render unless I make a random edit first (it can end up exactly the same, just needs to have some change. Deleting a random parenthesis and putting it back exactly how it did the trick temporarily), but that doesn't fix the browser not rendering.

For anybody encountering the same problem: The solution ended up being that "runtime: shiny" needed to not be tabbed over with the rest of the YAML


Solution

  • The solution ended up being that "runtime: shiny" needed to not be indented over with the rest of the YAML

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