With rmarkdown
version 2.3
Based on 7hibaut's answer, but not quite the same. Use the option class.source = "fold-show"
in the chunk header to show a chunk, when other chunks have been hidden with the code_folding: hide
in the YAML, as described on the rmarkdown pull request.
---
title: "Bohemian Rhapsody"
output:
html_document:
code_folding: hide
---
## Question 1
Are you in love with your car?
```{r class.source = NULL, eval = FALSE}
summary(cars)
```
## Question 2
Are you under pressure?
```{r class.source = NULL, eval = FALSE}
plot(pressure)
```
## Question 3
suggested code
```{r class.source = "fold-show", eval = FALSE}
library(dplyr)
library(magrittr)
a <- dMeasure::dMeasure$new()
a$open_emr_db()
## active patients
kensington_clinicians <- a$UserConfig %>>%
filter(
grepl(
"Kensington",
purrr::map_chr(Location, function(x) paste(x, collapse = ", "))
# map_chr will create a 'collapsed' version of all the
# listed locations
)
)
```
