Reproducible reporting guide

Build reports where code and story stay together.

Learn the essential R Markdown workflow—from YAML and executable chunks to controlled output, figures, and publication-ready tables with knitr::kable().

  • Self-paced
  • Runnable R examples

Learning path

From blank file to reproducible report.

Follow four connected stages, then return to any topic when your project needs it.

  1. 01

    Compose

    Structure the document

    Combine YAML metadata, Markdown prose, headings, links, mathematics, and parameters in one plain-text source.

    Explore document anatomy
  2. 02

    Compute

    Make analysis executable

    Add named R chunks and inline expressions so results, plots, and narrative values update from the same analysis.

    See a worked analysis
  3. 03

    Control

    Direct knitr

    Use chunk options to decide what runs, what appears, how figures render, and when caching is safe.

    Study chunk options
  4. 04

    Present

    Build readable tables

    Turn data frames and summaries into portable tables with captions, labels, alignment, rounding, and safe HTML.

    kable() in depth

The guide

One complete guide, from first file to final report.

One practical sequence with runnable examples, from document structure to dependable rendering.

Complete guide Self-paced

Complete guide

R Markdown: A Practical Guide to knitr and kable()

Build a reproducible report from first principles, then go deeper into code execution, caching, table output, and dependable rendering.

  • YAML & Markdown
  • Chunk options
  • Inline R
  • Figures
  • kable() tables
  • Reproducibility
Open the guide

Choose a path

Start with the route that fits your work.

You do not need to read every section in order. Choose a route, solve the task in front of you, then return for more depth.

Key concepts

Four pieces, one publishing workflow.

Each tool has a distinct job. Understanding those boundaries makes reports easier to debug, reuse, and share.

  1. 01 R Markdown The source
  2. 02 knitr The engine
  3. 03 Pandoc The converter
  4. 04 HTML The deliverable

One source of truth

Keep explanation, code, and output instructions together so every render starts from the same documented analysis.

Intentional execution

knitr evaluates chunks in order and captures their text, tables, messages, and figures for the next stage.

A function, not a package

kable() is a table-formatting function exported by knitr. The full name is knitr::kable().

Portable output

Pandoc converts the intermediate document into HTML, Word, PDF, or another format selected in YAML.