Thomas Speidel
Thomas Speidel

Reputation: 1443

How to break a long R markdown document

I often find that in using RStudio R markdown, the resulting HTML can get quite long and heavy. What strategies can someone use to break down or otherwise manage long documents?

Upvotes: 1

Views: 412

Answers (2)

Yihui Xie
Yihui Xie

Reputation: 30114

This is the default behavior of bookdown. See Chapter 3 of its documentation for details. In particular, look for the option split_by in 3.1.1 and 3.4.

Upvotes: 1

hvollmeier
hvollmeier

Reputation: 2986

Create a table of contents (TOC) to move quickly to the different sections of your document. You do it by requesting a toc in the doc header, something like this:

---
title: "MyDoc"
output:
  html_document:
    toc: yes
---

Instead of being stuck at the top of a long document you can also produce a “floating toc" by adding a custom css-file. Have a look at this example.

Upvotes: 2

Related Questions