Chunk label

Chunks can be given an optional label, e.g.

This has three advantages:

  1. Navigate to specific chunks using the drop-down code navigator in the bottom-left of the script editor:

Snippet of RStudio IDE showing only the drop-down code navigator
which shows three chunks. Chunk 1 is setup. Chunk 2 is cars and
it is in a section called Quarto. Chunk 3 is pressure and it is in
a section called Including plots.

  1. Graphics produced by the chunks will have useful names that make them easier to use elsewhere.

  2. You can set up networks of cached chunks to avoid re-performing expensive computations on every run.

  • Important!
    • Your chunk labels should be short but evocative and should not contain spaces.
    • We recommend using dashes (-) to separate words (instead of underscores, _) and no other special characters in chunk labels.
    • Use whatever name, except: setup, which is used for a specific reason.
    • Additionally, chunk labels cannot be duplicated.
    • Each chunk label must be unique.