I'm creating a template file for R markdown / R notebook. There are several code chunks that I wish will remain folded when the .rmd
is being opened. Is this possible?
Example
Let's say that we have the following code, and we save it (without the ##
) into a file named my_file.rmd
## ---
## title: "R Notebook"
## output: html_notebook
## ---
## # step 0 -- my predefind functions
## ```{r my_func()}
## my_func <- function(x) {
## x + 1
## }
## ```
## ```{r my_func_2()}
## my_func_2 <- function(x) {
## x / 6
## }
## ```
## # step 1 -- your code here
## ```{r}
## ```
Is there a way we can open my_file.rmd
— using RStudio — with the chunks {r my_func()}
and {r my_func_2()}
being folded upon opening the file?
You coud use
code_folding: hide
YAML combined withclass.source = 'fold-show'
for he chuncks you want to show, see: