← Back to learnwithForhad

Quarto for Data Scientists: From Notebooks to Websites

A hands-on guide to using Quarto for reproducible reports, presentations, blogs, and full websites — the modern replacement for R Markdown.


What is Quarto?

Quarto is the next generation of R Markdown — but it's language-agnostic. It supports R, Python, Julia, and Observable JS in the same document. It's built by Posit (formerly RStudio) and works with VS Code, JupyterLab, and RStudio IDE.

Think of it as: write in Markdown, embed code chunks, render to HTML, PDF, Word, slides, websites, or books. One tool for everything.

Your First Quarto Document

Create a file called analysis.qmd:

---
title: "Sales Analysis Q4"
author: "Forhad"
format: html
execute:
  echo: true
  warning: false
---

Then add code chunks just like R Markdown:

```{r}
library(tidyverse)
library(gt)

sales_data |>
  group_by(region) |>
  summarise(total = sum(revenue)) |>
  gt() |>
  fmt_currency(total)
```

Render it from the terminal:

quarto render analysis.qmd

Mixing R and Python

This is where Quarto really shines. In the same .qmd file, you can have R chunks and Python chunks that share data via the reticulate bridge:

```{r}
library(reticulate)
sales_summary <- sales_data |> group_by(region) |> summarise(n = n())
```

```{python}
import matplotlib.pyplot as plt
# Access R data directly
r.sales_summary.plot(kind='bar', x='region', y='n')
plt.title("Sales by Region")
plt.show()
```

Building a Blog with Quarto

Quarto has first-class support for blogs and websites. Scaffold one:

quarto create project blog myBlog

This gives you a _quarto.yml config, an index.qmd listing page, and a posts/ folder. Each post is a folder with an index.qmd:

# posts/my-first-post/index.qmd
---
title: "My First Post"
date: "2026-01-01"
categories: [R, forecasting]
image: thumbnail.png
---

Your content here with code chunks...

Run quarto preview for live-reload development. Deploy to GitHub Pages, Netlify, or Quarto Pub with a single command.

Presentations

Want slides? Just change the format:

---
title: "ML in Production"
format: revealjs
---

## Slide 1
Content here

## Slide 2 {.smaller}
```{r}
plot(mtcars$mpg, mtcars$wt)
```

Takeaway

Quarto is the single tool that replaces R Markdown, Jupyter notebooks (for publishing), bookdown, blogdown, and xaringan. If you're writing anything that mixes code and narrative, Quarto should be your default.