In an R notebook, is it possible to make a graph discoverable? I would like the graph to be revealed only when a user wants to see it.
Imagine a situation where some readers may want to see a level of detail that I don't want to show by default, because I expect it to be distracting or confusing for most readers.
The best I've been able to come up with is to use tabs and have the default tab be empty. But it feels like a bit of a hack. Are there other ways to implement discoverability?
---
output: html_document
---
```{r setup, include = FALSE, message = FALSE, echo = FALSE}
library(tidyverse)
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
tidy = TRUE,
warning = FALSE
)
```
### Mileage
The average mpg for the cars in this dataset is `r round(mean(mpg$hwy), 1)`.
#### Distribution of the data {.tabset .tabset-fade .tabset-tabs}
##### Hide
##### Show
```{r}
qplot(mpg$hwy, bins = 20)
```