HCAI
HCAI

Reputation: 2263

RenderDT won't show when rendered

I have a very simple flexdashboard where I would like display the iris data in a table using DT::renderDT(iris). It renders when I click "knit" in RStudio, but when I run markdown::render("test.Rmd") I get junk. It won't render on shinyapps.io either. Is there something trivially simple that I'm missing?

---
title: "Iris data"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    runtime: shiny_prerendered
---

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

```


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

### Chart A

```{r}
DT::renderDT(iris)
``

Produces the following:

enter image description here

Upvotes: 0

Views: 472

Answers (1)

Max Teflon
Max Teflon

Reputation: 1800

Yes, there is ^^

It took me quite some time to find the mistake, but you are missing one of the three backticks in the definition of your chunk.

This should work:

---
title: "Iris data"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    runtime: shiny_prerendered
---

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

```


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

### Chart A

```{r}
data <- shiny::reactive({iris})
DT::renderDT(data())
```

Upvotes: 1

Related Questions