Is there a way to add a dropdown menu to one element on flexdashboard so that the user can pick which table is shown? In this example I have 3 small tables, one for each species, but i would like to only show one table at the time, and to be able to change which one is shown using the dropdown menu. I tried using tabs, but there is another table which should be shown in the column at all times, and couldn't find the way around that. thank you very much!
---
title: "Titulo"
output:
flexdashboard::flex_dashboard
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
```
Column {data-width=500}
-----------------------------------------------------------------------
### Small table 1
```{r, echo=FALSE}
iris %>% filter(Species=="setosa")
```
### Small table 2
```{r,echo=FALSE}
iris %>% filter(Species=="virginica")
```
### Small table 3
```{r, echo=FALSE}
iris %>% filter(Species=="versicolor")
```
### Not related table
```{r, echo=FALSE}
cars
```
Column {data-width=500}
-----------------------------------------------------------------------
### BIG PLOT
```{r}
plot(cars, pch = 20)
```
The documentation for flexdashboard
is not very helpful, but looking at the examples it would seem that including runtime: shiny
on the header will let you get away with using any shiny
input and render functions:
---
title: "Titulo"
output:
flexdashboard::flex_dashboard
runtime:
shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
```
Column {data-width=500}
-----------------------------------------------------------------------
### Small table
```{r, echo=FALSE}
selectInput("small_table", "Table to show:",
c("setosa","virginica","versicolor"))
```
```{r, echo=FALSE}
renderTable(
iris %>% filter(Species == input$small_table)
)
```
### Not related table
```{r, echo=FALSE}
cars
```
Column {data-width=500}
-----------------------------------------------------------------------
### BIG PLOT
```{r}
plot(cars, pch = 20)
```