TL;DR: R Markdown lets you combine text, code, and outputs in one document you can knit to HTML/PDF/Word for fully reproducible reports.
R Markdown is a plain-text authoring format that blends
Markdown for writing with R code (and
other languages) for computation. You write a single .Rmd
file and knit it to produce polished documents
(HTML/PDF/Word), slides, or dashboards.
Under the hood:
flowchart LR
A[.Rmd] -→ B[knitr: execute R code]
B -→ C[Markdown + results]
C -→ D[Pandoc: convert]
D -→ E[HTML / PDF / Word / Slides]
You can also add formatting, links, images, and more to your document. Here are some examples:
# This is an H1
## This is an H2
*This text will be italic*
→ This text will be
italic
**This text will be bold**
→ This text will be
bold
Unordered:
- Item 1
- Item 2
- Item 2a
- Item 2b
Ordered:
1. Item 1
2. Item 2
3. Item 3
- Item 3a
- Item 3b
Inline code:
Min. : 4.0 , 1st Qu.:12.0 , Median :15.0 , Mean :15.4 , 3rd Qu.:19.0 , Max. :25.0 , Min. : 2.00 , 1st Qu.: 26.00 , Median : 36.00 , Mean : 42.98 , 3rd Qu.: 56.00 , Max. :120.00
→ Min. : 4.0 , 1st Qu.:12.0 , Median :15.0 , Mean :15.4 , 3rd Qu.:19.0 ,
Max. :25.0 , Min. : 2.00 , 1st Qu.: 26.00 , Median : 36.00 , Mean :
42.98 , 3rd Qu.: 56.00 , Max. :120.00
Links: [R Project](https://www.r-project.org/)
→ R Project Images

→
Quotes and footnotes:
> A quoted thought.
---
A sentence with a footnote.^[Footnote text.]
Mathematics (LaTeX):
Inline: $E = mc^2$
→ \(E =
mc^2\) Block:
$$
\int_a^b f(x)dx = F(b) - F(a)
$$
\[ \int_a^b f(x)dx = F(b) - F(a) \]
---
lines. For example: ---
title: "My Document"
output: html_document
theme: readable
toc: true
toc_depth: 2
toc_float: true
number_sections: true
date: "2025-09-23"
---
R code chunks are enclosed by triple backticks and
{r}
. For example:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can customize code chunks with options like
echo
, eval
, message
,
warning
, etc. For example:
{r my_chunk}