How to split flexdashboard pages into multiple rmd files? - r

I've created a dashboard using rmarkdown flexdashboard with multiple pages. Is it possible to split out each page into its own rmd file since each page is heavy on content and includes multiple plots? In the code below, I'd like to split out each season into its own rmd file but maintain the same tabbed format in flexdashboard.
---
title: "Seasons"
output: flexdashboard::flex_dashboard
---
Summer
=====================================
Column {data-width=600}
-------------------------------------
### Chart 1
```{r}
```
Column {data-width=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
Fall {data-orientation=rows}
=====================================
Row {data-height=600}
-------------------------------------
### Chart 1
```{r}
```
Row {data-height=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
Winter {data-orientation=rows}
=====================================
Row {data-height=600}
-------------------------------------
### Chart 1
```{r}
```
Row {data-height=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
Spring {data-orientation=rows}
=====================================
Row {data-height=600}
-------------------------------------
### Chart 1
```{r}
```
Row {data-height=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```

Yes, you can create a r-markdown file for each season and then include these in the main r-markdown file using the child chunk-option.
So the four Rmd file would be,
season1.Rmd
Summer
=====================================
Column {data-width=600}
-------------------------------------
### Chart 1
```{r}
```
Column {data-width=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
season2.Rmd
Fall {data-orientation=rows}
=====================================
Row {data-height=600}
-------------------------------------
### Chart 1
```{r}
```
Row {data-height=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
season3.Rmd and season4.Rmd file would be of similar construct.
Then the main rmarkdown file would look like,
main_flexdashboard.Rmd
---
title: "Seasons"
output: flexdashboard::flex_dashboard
---
```{r child = 'season1.Rmd'}
```
```{r child = 'season2.Rmd'}
```
```{r child = 'season3.Rmd'}
```
```{r child = 'season4.Rmd'}
```
Then simply knitting this main_flexdashboard.Rmd would get you the same result.
Note that, all these child documents (season1.Rmd, season2.Rmd, etc) need to be in the same folder (directory) as the main_flexdashboard.Rmd file.

Related

Layout objects on R Slidy using flexdashboard or HTML... or some other method

I'm really looking for a guide on the layout of Slidy slides. Specifically, I'm trying to arrange plots and tables on a slide. I guess the flexdashboard example would look something like below:
---
title: "Min_Example"
author: "Brian Balzar"
date: "3/23/2022"
output: slidy_presentation
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Example Slide
## Row
### Equation
$$
a^2 + b^2 = c^2
$$
## Row
## Column 1
### Summary
```{r cars, echo = TRUE}
summary(cars)
```
## Column 2
### Chart
```{r plot}
plot(cars)
```
### Row
```{r table}
knitr::kable(cars)
```
I'm open to doing this in HTML, just need to know how to do it!

Flexdashboard shows blank tab meant for mobile-only view

I have a flexdashboard that uses a tabular display. I want one version of a tab to display in desktop view, and another in mobile view. When I use the {.mobile} specification, it displays a duplicate of the non-mobile tab in desktop view, except with blank contents.
Example code:
---
title: "MY DASHBOARD"
output:
flexdashboard::flex_dashboard:
theme:
version: 5
bootswatch: cosmo
runtime: shiny
---
Charts {.tabset}
-------------------------------------
### Chart 1
{r}
head(airquality)
### Chart 2
{r}
head(mtcars, n = 3)
### Chart 2 {.mobile}
{r}
head(iris, n = 3)
What it looks like in desktop:
Answered my own question. It seems that this feature of flexdasboard only works if you individually set the non-mobile tabs to be {.no-mobile}, and then recreate the mobile-friendly tabs under a new tabset that is globally {.mobile}
---
title: "MY DASHBOARD"
output:
flexdashboard::flex_dashboard:
theme:
version: 5
bootswatch: cosmo
runtime: shiny
---
Charts {.tabset}
-------------------------------------
### Chart 1 {.no-mobile}
{r}
head(airquality)
### Chart 2 {.no-mobile}
{r}
head(mtcars, n = 3)
Charts {.tabset .mobile}
-------------------------------------
### Chart 1
{r}
head(airquality)
### Chart 2
{r}
head(iris, n = 3)

Flexdashboard in R - Columns Orientation

I am trying to design my Dashboard in R through Markdown, but I am not able get exactly the design wished.
In the section Tab I want to insert {.tabset} option keeping the same design above. Nevertheless, when I try do it, the design changed for the image below:
Could someone help insert the .tab format in the first image design?
Below the first R Markdown code
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
`r knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, cache = F)`
```{css, echo=FALSE}
.fluid-row {
font-size: 5.9vw;
}
```
```{r setup, include=FALSE}
# Libraries ---------------------------------------------------------------
pacman::p_load(ggplot2, tidyr, readxl ,dplyr, forcats, fitdistrplus,lubridate,
tseries, forecast, timetk, zoo,wktmo, plotly,magrittr,
widgetframe, data.table, webshot, htmlwidgets,stringr,
formattable, calendR, flexdashboard)
options(scipen=999)
setwd('/media/arduin/Ubuntu HDD/02. Sanofi/04. Calendar')
```
Page 1
=====================================
Row {.tabset}
-------------------------------------
### Tab
```{r, echo=FALSE, results='hide'}
```
Row
-------------------------------------
### Tabla 1
```{r, echo=FALSE, error=TRUE, fig.height=8, message=FALSE, warning=FALSE}
```
Column {.tabset}
-------------------------------------
### Graph 1
```{r, attr.output='style="max-height: 100px;"'}
```
### Graph 2
```{r}
```
### Graph 3
```{r}
```
### Graph 4
```{r}
```
### Graph 5
```{r}
```
Are you looking for something like this?
---
title: "Flexdashboard"
output: flexdashboard::flex_dashboard
---
Page 1
=====================================
Column {data-width=400}
-------------------------------------
### Chart 1
```{r}
```
### Chart 2
```{r}
```
Column {.tabset data-width=400}
-------------------------------------
### Graph 3
```{r}
```
### Graph 4
```{r}
```
### Graph 5
```{r}
```
### Graph 6
```{r}
```
I used This link for the layout code, I think you may want Column, not Row when making the boxes, also the data-width helps with the layout like it shows in the link

flexdashboard layout with tabset

how do I get such a layout in flexdashboard?
Unless you know a lot of webdev, this isn't really possible with flexdashboard, but what you could do is have each tabbed sections with the box next to it, and then separate them by pages in Flexdashboard
---
title: "Tabset Column"
output: flexdashboard::flex_dashboard
---
Section
===========================================================
Column {.tabset}
-------------------------------------
### Chart 1
```{r}
```
### Chart 3
```{r}
```
Column
-------------------------------------
### Chart 2
```{r}
```
Section 2
===========================================================
Column {.tabset}
-------------------------------------
### Chart 1
```{r}
```
### Chart 3
```{r}
```
Column
-------------------------------------
### Chart 2
```{r}
```
Which gives me a similar layout, not exactly as you wanted, this may be possible with Shiny code.

Plot a hierarchy tabs in R Markdown

I have been trying to plot a hierarchy tabs in R markdown but somehow when I knit the document it does not show the tabs. I was expecting: Score should have Plots and Plots123 as sub tab and Score1 should be aligned with Score tab. But my output does not show any tabs.
PS: (I have purposely written `` while defining a chunk because Stack overflow interprets '```' as code)
## Score {.tabset}
### Plots
``
{r pressure, echo=FALSE}
plot(pressure)
``
### Plots123
``{r pressure_1, echo=FALSE}
plot(pressure)
``
## Scores1 {.tabset}
``{r pressure_2, echo=FALSE}
plot(pressure)
``
Here's my version - this seems to work. Try this out exactly and let me know.
For rmarkdown, all sub-headers of the header with the .tabset attribute appear within tabs rather than as standalone sections. Also, trying additional spacing between headers.
---
title: "Test"
author: "Test"
date: "2/29/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Score {.tabset}
### Plots
```{r pressure, echo=FALSE}
plot(pressure)
```
### Plots123
```{r pressure_1, echo=FALSE}
plot(pressure)
```
## Scores1 {.tabset}
```{r pressure_2, echo=FALSE}
plot(pressure)
```

Resources