Where are the section headings in flexdashboard? - r

I have a flexdashboard with multiple tabs, one of which I would like to write as a smart book down document. But there are no section headings, where have they gone?
Why do I expect it to look like this example? enter link description here
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
```
**Contact**
aaa#abcd.edu
## What we are trying to estimate?
This is a tool whhich is designed to estimate viral dose to individual passengers on ABC under a variety of conditions.
Whilst a dose-response curve doesn't yet exist for `SARS CoV-2`, we have employed an exponential model for `HCoV229-E`, whihch is thhough to be a reasonable analogogus pathogen.
## Second sub.section

This code will work. The only change is the use of ###. See here for a known bug https://github.com/rstudio/flexdashboard/pull/250
Change
## What we are trying to estimate?
to
### What we are trying to estimate?
Change
## Second sub.section
to
### Second sub.section

Related

Removing Empty Spaces in R

I found this tutorial here that I want to follow: https://beta.rstudioconnect.com/jjallaire/htmlwidgets-showcase-storyboard/htmlwidgets-showcase-storyboard.html
I would like to try and find a way to remove the "empty spaces" that appear in the tabs (e.g. remove the spaces below the red line):
Is there a way to do this in R? I tried to follow the advice recommended in this post over here (Format tab icon size in R flexdashboard) and manually change the font size in hopes that this would work:
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
<style>
.active {
font-size:15px;
}
</style>
a_tab_name {data-icon="fa-calendar"}
=====================================
Column {data-width=150}
-----------------------------------------------------------------------
### Chart B
```{r}
```
### Chart C
```{r}
```
This seemed to have worked - but is there an automatic way to instruct R to remove all empty spaces in these tabs?
Thank you!
Use height: auto
---
title: "HTML Widgets Showcase"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
```
```{css}
.storyboard-nav .sbframelist ul li {
height: auto;
}
```
### Leaflet is a JavaScript library for creating dynamic maps that support panning and zooming along with various annotations.
### d3heatmap creates interactive D3 heatmaps including support for row/column.
### Dygraphs provides rich facilities for charting time-series data in R and includes support for many interactive features.
### Plotly provides bindings to the plotly.js library
Which looks like,

Navigate to tab in Shiny at the same level as parent tab

I am writing a report in R Markdown using shiny runtime. It has four main sections which I want to make accessible through the tabset functionality. However, I would really like to embed buttons in each individual section which allows you to jump to another section.
A minimal example is included below, where I tried to follow this example but it doesn't seem to work outside of the flexdashboard setup. To make things even more complex, I would like to be able to trigger switching sections on an observeEvent-type of way. Specifically, I'm trying to include some simple barplots in some of the sections which, when clicked on, bring the user to another section.
Any help is greatly appreciated!
---
title: "Example Report"
output:
html_document
runtime: shiny
---
# {.tabset .tabset-fade .tabset-pills}
## A. {#mytab1}
```{r, echo = FALSE}
tags$a(href = "#section-mytab2",
shiny::actionButton("btn1", "go to mytab2")
)
```
### Summary
### Methodology
## B. {#mytab2}
### Summary
### Methodology
## C. {#mytab3}
### Summary
### Methodology
## D. {#mytab4}
### Summary
### Methodology

How to create a figure note below the figure caption in r markdown and bookdown

I am struggling to create a figure note below the figure caption in r markdown and bookdown. The figure note I want looks like below. This figure is from (Greenstone and Hanna 2014). My figure actually is a
r plot. The note should be the same length as the figure width and automatically break the line. Any ideas???
If you are using a format that goes through LaTeX (e.g. pdf_book or pdf_document), this is possible. I don't know if there's a way to do it with HTML output. (But does that move figures around? Maybe plain text below the figure is enough). The idea is to enter the LaTeX code to
start and end the figure yourself, and include the note within that block. Here's an example, based on the standard pdf_document example.
---
title: "Untitled"
output:
pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Including Plots
You can also embed plots, for example: Figure \ref{fig:pressure}.
```{=latex}
\begin{figure}[t]
```
```{r pressure, echo=FALSE}
plot(pressure)
```
```{=latex}
\caption{Air quality monitors across India. \label{fig:pressure}}
\textit{Notes:} Dots denote cities with monitoring stations
under India's National Ambient Air Monitoring Programme
(NAAMP). Geographical data are drawn from MIT's Geodata
Repository.
\end{figure}
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

How to ensure tabset contains the correct data

The goal is to create a a page in Rmarkdown that contains two tabs each displaying different information. After over a dozen different tries I've decided it makes sense to ask since the closest I've gotten as shown in the image is two tabs both showing the same information. Not sure what it is I'm missing. I've searched a couple other questions and none of them address the issue.
This is the code that I have tried so far
---
title: test
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
self_contained: false
---
Page
========================
## Try {.tabset}
### Tryto
```{r}
cat(paste("WORDSSSSS"))
```
### Work
```{r}
cat(paste("WORDSSSSSqqqqqqqqq"))
```
I included the single quotes here since it was messing with how things were displayed in SO so please remove.
Desired out put would have "WORDSSSSS" under the "Tryto" tab and "WORDSSSSqqqqqqqqqq" under "Work".
Thanks!
EDIT:
packages
---
title: "Test"
output: html_document
---
## Try {.tabset}
### Tryto
```{r}
cat(paste("WORDSSSSS"))
```
### Work
```{r}
cat(paste("WORDSSSSSqqqqqqqqq"))
```

How can I change the number of columns several times in an R Markdown pdf document?

I am creating a .pdf using R Markdown. I would like to have a section of text in two column format, and then follow that with a graph (or table, photo, etc.) that takes up the entire width of the page, and then return to two column text. I am new at Markdown / LaTex / Pandoc and I cannot figure out how to do it.
This answer by #AlisonShelton appears to be what I want, but when I run it I get this error in the RStudo R Markdown console:
! Undefined control sequence.
l.87 \btwocol
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
I have successfully used this method by #scoa to make a two column .pdf, but I don't know how go back and forth between one and two columns using this.
Here is some sample code for testing purposes
---
title: "Test"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Two columns of text
This seciton should be in two column format.
Here are a bunch of ? to make it longer: ???????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????
## Once column section.
This part should be the whole page width
```{r plot}
plot(rnorm(20),rnorm(20))
```
## Now 2 columns again
This section should go back to two columns !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
What you can do is first, to add -- as you stated -- pandoc_args: ... into your YAML header. Second, there are a few LaTeX solutions around (like this or this one) which won't work for RMarkdown. The only way I found so far is to use \onyecolumn / \twocolumn -- just with the drawback of the page breaks. But perhaps you can live with it until there's a better solution.
---
title: "Test"
output:
pdf_document:
pandoc_args: [
"-V", "classoption=twocolumn"
]
html_document: default
header-includes:
- \usepackage{lipsum} # just used for producing example text in document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Two columns of text
\lipsum[1-7]
\onecolumn
## Once column section.
This part should be the whole page width
```{r plot}
plot(rnorm(20),rnorm(20))
```
\lipsum[1]
\twocolumn
## Now 2 columns again
This section should go back to two columns
\lipsum
\begin{table*}
This is nice, but won't work with R chunks or headers. And you'll have to format with LaTeX code (e.g. \textbf{Foo blaah}).
\lipsum[1]
\end{table*}
\lipsum

Resources