For the life of me I can't work this out, I'm using Flexdashboard in R Studio and I have two tables. What I want to be able to do is to switch the table being being shown via a selectInput. My selectInput is currently:
```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(png)
library(grid)
library(kableExtra)
library(knitr)
```
```{r, echo = FALSE}
selectInput("platform", label = "Select Platform:",
choices = c("MB","DS"))
```
The csv files for MB_Val and DS_Val can be extracted from here:
DS_Val here
MB_Val here
My two charts are as follows:
MB_Val %>%
mutate(Val = cell_spec(
format(round(Val, 2), nsmall = 2), "html", color = "white", bold = T,
background = "#7FC64F")) %>%
mutate(ValFm = cell_spec(
format(round(ValFm, 2), nsmall = 2), "html", color = "white", bold = T,
background = "#7FC64F")) %>%
kable("html", escape = F, align = c('l',rep('c',ncol(MB_Val)-1))) %>%
kable_styling(bootstrap_options = c("striped", "condensed","hover")) %>%
scroll_box()
and
DS_Val %>%
mutate(Val = cell_spec(
format(round(Val, 2), nsmall = 2), "html", color = "white", bold = T,
background = "#7FC64F")) %>%
mutate(ValFm = cell_spec(
format(round(ValFm, 2), nsmall = 2), "html", color = "white", bold = T,
background = "#7FC64F")) %>%
kable("html", escape = F,align = c('l',rep('c',ncol(DS_Val)-1))) %>%
kable_styling(bootstrap_options = c("striped", "condensed","hover")) %>%
scroll_box(height = "200px")
I've tried a number of things, the most recent being this. I'd love to be able to keep all the formatting too if possible.
```{r, echo = FALSE}
div(renderTable({ifelse(input$platform %in% c("MB"),MB_Val,DS_Val)}),
style = "font-size:80%")
```