| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
|---|---|---|---|---|
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
| 4.9 | 3.0 | 1.4 | 0.2 | setosa |
| 4.7 | 3.2 | 1.3 | 0.2 | setosa |
| 4.6 | 3.1 | 1.5 | 0.2 | setosa |
| 5.0 | 3.6 | 1.4 | 0.2 | setosa |
| 5.4 | 3.9 | 1.7 | 0.4 | setosa |
GEN242: Data Analysis in Genome Biology
2026-05-30
Environments that combine narrative text with executable code. When rendered, code is executed and its output — tables, figures, equations — is woven into a polished HTML, PDF, or Word document.
| Benefit | What it means in practice |
|---|---|
| Reproducibility | Results regenerate automatically when code or data changes |
| Transparency | Readers can inspect every line of code behind each result |
| Collaboration | Plain-text source files integrate naturally with Git |
| Versatility | One source → report, website, slide deck, journal article |
.qmd) — current recommended system; used for all GEN242 course projects.Rmd) — predecessor; still abundant in Bioconductor vignettes and published R workflowsknitr executes R → pandoc converts to HTML/PDF| Syntax | Result |
|---|---|
**bold** |
bold |
_italic_ |
italic |
# Heading 1 / ## Heading 2 |
Section / subsection heading |
- item |
Bullet list |
1. item |
Numbered list |
[@key] |
Citation |
[text](url) |
Hyperlink |
`code` |
Inline code |
$$...$$ |
Display math |
Full reference: https://quarto.org/docs/authoring/markdown-basics.html
Every .qmd / .Rmd document has the same structure:
Structure of Quarto and R Markdown documents
Quarto ships with RStudio ≥ 2022.07. Standalone install or updates: https://quarto.org/docs/get-started/
sample.qmd — Quarto templatebibtex.bib — reference fileOr in RStudio: File → New File → Quarto Document
From R:
quarto::quarto_render("sample.qmd") # HTML (from YAML)
quarto::quarto_render("sample.qmd", output_format="pdf") # override to PDFFrom the command line:
In RStudio: click the Render button or press Ctrl+Shift+K
---
title: "My Project Report"
author: "Author: First Last"
date: last-modified
format:
html:
theme: flatly # alternatives: cosmo, lumen, default
toc: true
toc-depth: 3
number-sections: true
fig-cap-location: bottom
embed-resources: true # single self-contained HTML file
bibliography: bibtex.bib
---| Option | Effect |
|---|---|
format: html / pdf / docx |
Output format |
theme: |
Visual style — see Quarto HTML Themes |
toc: true + toc-depth: 3 |
Table of contents, 3 heading levels |
number-sections: true |
Auto-numbered section headings |
embed-resources: true |
Single portable HTML file — use for submissions |
date: last-modified |
Auto-inserts file modification date |
Full options reference: https://quarto.org/docs/reference/formats/html.html
Set once in the YAML — applies to every chunk unless overridden individually:
```{r chunk_name}
#| eval: true
#| echo: true
#| warning: false
#| fig-height: 4
#| fig-cap: "Diamond price by color"
ggplot(dsmall, aes(color, price/carat)) +
geom_jitter(alpha = 0.5, aes(color = color))
```Options are written as #| comment lines inside the chunk — one per line.
| Option | Values | Effect |
|---|---|---|
eval |
true / false |
Execute the chunk |
echo |
true / false |
Show source code in output |
warning |
false |
Suppress warnings |
message |
false |
Suppress messages |
cache |
true |
Cache results (speeds up re-rendering) |
fig-height |
number (inches) | Figure height |
fig-width |
number (inches) | Figure width |
fig-cap |
"text" |
Figure caption |
label |
fig-name |
Label for cross-referencing (prefix fig- required) |
Full reference: https://quarto.org/docs/reference/cells/cells-knitr.html
```{r}
#| label: fig-diamonds
#| fig-cap: "Diamond price by color."
ggplot(dsmall, aes(color, price/carat)) +
geom_jitter(alpha = 0.5, aes(color = color))
```In prose: As shown in @fig-diamonds, price varies by color.
Renders as: “As shown in Figure 1, price varies by color.”
The same scheme works for tables (tbl- prefix) and sections (sec- prefix).
knitr::kable| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
|---|---|---|---|---|
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
| 4.9 | 3.0 | 1.4 | 0.2 | setosa |
| 4.7 | 3.2 | 1.3 | 0.2 | setosa |
| 4.6 | 3.1 | 1.5 | 0.2 | setosa |
| 5.0 | 3.6 | 1.4 | 0.2 | setosa |
| 5.4 | 3.9 | 1.7 | 0.4 | setosa |
Clean, publication-ready. Works for both HTML and PDF output.
DT::datatableSortable, filterable, paginated — HTML output only.
Warning
JavaScript-dependent output (DT::datatable, plotly) renders to HTML only, not PDF. Use knitr::kable when PDF output is needed.
Figure size is controlled with fig-height and fig-width chunk options, or globally under execute: in the YAML header.
Write to file and insert by path — useful when figure generation is slow:
Embed evaluated R expressions directly in prose by enclosing them with a backtick, the letter r, a space, the expression, and a closing backtick.
Example: writing the expression nrow(iris) inline evaluates to 150 at render time.
Quarto also supports inline Python and Julia expressions when those engines are active.
Standard LaTeX syntax — $...$ for inline, $$...$$ for display:
Renders as:
\[d(X,Y) = \sqrt{ \sum_{i=1}^{n}{(x_i - y_i)^2} }\]
LaTeX math reference: https://en.wikibooks.org/wiki/LaTeX/Mathematics
Store references in a .bib file, list it under bibliography: in the YAML header, then cite with [@key]:
_quarto.yml — project-level configurationWhen multiple .qmd files form a website or course site, a _quarto.yml file in the project root controls shared settings. Individual files inherit and only override what they need.
project:
type: website
output-dir: docs
website:
title: "My Site"
navbar:
left:
- href: index.qmd
text: Home
format:
html:
theme: cosmo
toc: trueNote
GEN242 course project reports are standalone files — no _quarto.yml needed. Include all settings directly in your document’s YAML header.
| Format | YAML key | Use case |
|---|---|---|
| HTML document | format: html |
Reports, course projects |
format: pdf |
Print-ready manuscripts | |
| Word | format: docx |
Collaboration with non-R users |
| RevealJS slides | format: revealjs |
Presentations (this slide deck!) |
| Website | project: type: website |
Course sites, documentation |
.ipynb files can be rendered directly:
Or use the Jupyter engine in a .qmd:
See the Quarto Python documentation.
The predecessor to Quarto — same knitr/pandoc toolchain, very similar syntax. Still widely used: most Bioconductor package vignettes are written in R Markdown.
---
title: "My R Markdown Document"
author: "Author: First Last"
date: "Last update: 27 May, 2026"
output:
BiocStyle::html_document:
toc: true
toc_depth: 3
fig_caption: yes
fontsize: 14pt
bibliography: bibtex.bib
---Key difference from Quarto: output: instead of format:, underscore option names (toc_depth) instead of kebab-case (toc-depth).
Options are comma-separated on the opening line rather than #| lines inside.
Template: sample.Rmd
Add embed-resources: true to bundle all CSS, JS, and figures into a single HTML file:
Ideal for submitting course reports — no broken links, no missing images.
Render locally, then create a symbolic link from your .html directory:
View at: https://cluster.hpcc.ucr.edu/~ttest/rmarkdown/sample.html
Follow the HPCC setup instructions to enable HTML viewing for your account.
For public GitHub repositories, follow the instructions here.
Quarto also has native GitHub Pages support:
See the Quarto publishing documentation.
Markdown prose · LaTeX math · Bibtex citations · knitr::kable · DT::datatable · ggplot2 · inline R code · knitr/pandoc render pipeline
| Feature | Quarto (.qmd) |
R Markdown (.Rmd) |
|---|---|---|
| Output format key | format: html |
output: html_document |
| Option naming | kebab-case: toc-depth |
underscore: toc_depth |
| Date | last-modified |
inline R expression |
| Chunk options | #\| eval: false inside chunk |
{r name, eval=FALSE} on opening line |
| Global chunk defaults | execute: in YAML |
knitr::opts_chunk$set(...) |
| Render from R | quarto::quarto_render() |
rmarkdown::render() |
| Render from CLI | quarto render file.qmd |
Rscript -e "rmarkdown::render(...)" |
| Figure cross-refs | native @fig-label |
requires bookdown |
| Callout blocks | ::: {.callout-note} |
not available |
| Multi-language | R, Python, Julia natively | R only (Python via reticulate) |
| Project config | _quarto.yml |
_site.yml / _bookdown.yml |
.Rmd-style chunk headers correctly (backward compatible)knitr → .md → pandoc → HTML / PDFembed-resources: true and theme: flatly or cosmo| Resource | URL |
|---|---|
| GEN242 tutorial | https://girke.bioinformatics.ucr.edu/GEN242/tutorials/quarto/quarto_index.html |
| Quarto documentation | https://quarto.org/docs/guide/ |
| Quarto HTML options | https://quarto.org/docs/reference/formats/html.html |
| Quarto chunk options | https://quarto.org/docs/reference/cells/cells-knitr.html |
| Quarto themes | https://quarto.org/docs/output-formats/html-themes.html |
| R Markdown book | https://bookdown.org/yihui/rmarkdown/ |