flexdashboard
flexdashboard copied to clipboard
Multiple graphs and data tables in the sabe page on flexdashboard
I need to create plots and data tables in a single tabset in flexdashboard, so I made a different chunk for each output (graph or table). But the outputs doesn't appear with an vertical scroll as I expected, even when using vertical_layout: scroll. The outputs seems to have the right height, but I can't see all of them in the page. My code looks like this:
---
title: "dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
runtime: shiny
---
Column {.tabset}
----------------
### Report
#### Graph 1
```{r}
renderPlot({
# my plot code using ggplot()
), width = "auto", height = 600}
#### Graph 2
```{r}
renderPlot({
# my plot code using ggplot()
), width = "auto", height = 600}
#### Table 1
```{r}
renderDataTable({
# my table code using DT::datatable()
), , width = "auto", height = 600, filter = "top"
How can I make a scroll layout so all my outputs appear on that tab?
I think you need to set the data-height on the tabset:
---
title: "dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
---
Column {data-height=2000 .tabset}
----------------
### Report
#### Graph 1
```{r}
library(ggplot2)
library(DT)
ggplot(mtcars, aes(x = mpg, y = disp)) +
geom_point()
Graph 2
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point()
Table 1
datatable(mtcars)