Created
May 10, 2019 08:38
-
-
Save SemiQuant/9f010b330122f79861bbb63ad2ea3d30 to your computer and use it in GitHub Desktop.
Tab box in a flex dashboard with tabbed columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Tabbed Tabs" | |
author: "SemiQuant" | |
date: "5/10/2019" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: fill | |
--- | |
```{r setup, include=FALSE} | |
require(flexdashboard) | |
``` | |
Column {.tabset} | |
------------------------------------- | |
### Tab 1 | |
```{r echo=FALSE} | |
require(shinydashboard) | |
require(shiny) | |
require(plotly) | |
p1 <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box") | |
p2 <- plot_ly(midwest, x = ~percollege, type = "box", width = 600, height = 400) | |
# if you do not set the dimensions on the plot in the second tab it becomes distorted | |
tabBox(width=12, | |
title = "First tabBox", | |
id = "tabset1", | |
tabPanel("TabA", p1), | |
tabPanel("TabB", p2) | |
) | |
``` | |
------------------------------------- | |
### Tab 2 | |
```{r} | |
require(plotly) | |
plot_ly(midwest, x = ~percollege, color = ~state, type = "box") | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you SemiQuant! This workaround is indeed very helpful.
I am trying to display in this way:
(1) tables created with kableExtra::kable()
(2) graphs created with dygraphs::dygraph()
So far I have managed to do (1), transforming first the original table vía htmltools::HTML() (see code below). However, I am not able to do something similar with dygraph graphs (I got an Error in FUNC(X[[i]], ...): argument is not a character cector cCalls: >Anonymous> .... that I cannot make sense of).
I am quite new to R, flexdashboard and HTML code, and I do not have a good understanding of the objects that I am dealing with, which migtht explain why I am struggling with this. Can anyone help me?
Displaying a KABLE in nested tabs - It works
Row {.tabset}
Kable table
Displaying a DYGRAPH in nested tabs - It does not work
Row {.tabset}
Kable table