Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

RMarkdown: Header Summary/Overview in RStudio?

I have a long RMarkdown file that is organized with Headings. Scrolling through to find a Heading of interest has become time consuming.

Is there a way to display a summary/overview of all Headings in RStudio? Ideally one that is interactive so that I can click a Heading and automatically navigate to that location in the RMarkdown file? For instance in the following example, imagine each heading has a single code chunk under it, and Heading 2.1.2 is on line 2400. How can I easily navigate to this Heading 2.1.2 without scrolling through the RMarkdown file to find it manually?

In reality I have many more Headings. I’ve been hiding code chunks by clicking the arrow next to the Heading, but I’m hoping there is a better way to navigate through.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thank you!

# Heading 1

## Heading 1.1

### Heading 1.1.1

### Heading 1.1.2

### Heading 1.1.3


# Heading 2

## Heading 2.1

### Heading 2.1.1

### Heading 2.1.2

### Heading 2.1.3


>Solution :

In a Rmarkdown file opened with Rstudio, you can click on the "outline" button to enable a table of content next to your Rmd file, where you can navigate to different sections of your Rmd conveniently by clicking onto your desired header.

outline_button

Under the Rmarkdown section in the global option, you can choose whether to display section header only or to also include code chunks in the table of content.

global_option

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading