Written and maintained by CASRAI Editorial Board
Last updated
R presentations are slide decks built from R code, so that charts, tables and numbers on the slides are regenerated from your data each time the deck is rendered. There are three common routes: Quarto (to HTML slides with revealjs, or to PowerPoint), R Markdown with the powerpoint_presentation output, and the officer package, which writes PowerPoint files from R code. This guide shows each route, the exact heading-to-slide rules for the first two, and how to fix the usual problems.
What R presentations are used for in research
A slide deck that is rendered from a script is a reproducible output: when the data or the analysis changes, you render again and every figure and table on the slides updates. That suits lab meetings, progress reports and conference talks that reuse the same analysis. Plots made with ggplot2 can go straight onto slides; see ggplots in R for building them. For a defence or committee talk, the structure of the talk itself is covered in thesis defense presentation.
Choose a route
| Route | Output | How slides are defined | Template control |
|---|---|---|---|
Quarto, format: revealjs |
HTML slides | Markdown headings (## = slide, # = section with title slide) |
Built-in themes through the theme option |
Quarto, format: pptx |
PowerPoint | Same heading rules; slide-level option available |
reference-doc: template.pptx |
R Markdown, powerpoint_presentation |
PowerPoint | slide_level option; --- starts a headerless slide |
reference_doc: my-styles.pptx |
officer package |
PowerPoint | R code that reads and writes a PowerPoint file | Starts from an initial PowerPoint file or an empty default |
Quarto’s documentation describes it as a multi-language, next generation version of R Markdown that uses Knitr to execute R code and can render most existing R Markdown files, which is why the first two rows share the same heading conventions. The two tools are compared in Quarto vs R Markdown.
Install or access (official source only)
Quarto is installed from the official Quarto site (https://quarto.org/docs/get-started/), which lists the supported editors: Positron, VS Code, Jupyter, RStudio, Neovim and a plain text editor. To use Quarto with R, the Quarto documentation tells you to install the rmarkdown package:
install.packages("rmarkdown")
For the officer route, install the package from CRAN:
install.packages("officer")
The officer documentation lists its licence as MIT + file LICENSE. If you use RStudio, how to use RStudio covers the interface.
Step-by-step: build a slide deck
Route 1: Quarto to HTML slides (revealjs)
- Create a new file named
slides.qmd. - Add a YAML header with a title, an author and the format:
---
title: "Lab meeting"
author: "Your name"
format: revealjs
---
- Write the slides in Markdown. In Quarto, slides are delineated using headings: a level-2 heading (
##) starts a new slide, a level-1 heading (#) starts a section with its own title slide, and a horizontal rule (---) also separates slides. Theslide-leveloption changes this behaviour. - Put R code in a code chunk on the slide. Quarto executes R code blocks when the document is rendered.
- Optionally switch the look with the
themeoption. The default theme is used automatically:
format:
revealjs:
theme: dark
- Add speaker notes in a notes div, and press the S key in the rendered deck to open the speaker view:
::: {.notes}
Say the sample size first.
:::
- Render: use the Render button in RStudio, or run this in a system shell (the target file should always be the first command line argument):
quarto render slides.qmd
Route 2: Quarto or R Markdown to PowerPoint
For Quarto, change the format to pptx. The same heading rules apply (## for a slide, # for a section and title slide, --- to separate, slide-level to customise).
format: pptx
To show bullets one at a time, set incremental, or mark parts of the deck with the .incremental and .nonincremental divs:
format:
pptx:
incremental: true
To use your institution’s slide design, point Quarto at a template with reference-doc:
format:
pptx:
reference-doc: template.pptx
A starter template can be generated with this command from the Quarto documentation:
quarto pandoc -o template.pptx --print-default-data-file reference.pptx
Quarto picks a slide layout from the template by content. A Title Slide is built from the title, author and date metadata; Two Content is used for a .columns block with two or more .column divs; Comparison is used when one column has text followed by non-text content; and Blank is used for slides that contain only notes. The template must contain layouts with these names: Title Slide, Title and Content, Section Header, Two Content, Comparison, Content with Caption and Blank. Missing layouts fall back to the default reference document with a warning.
For R Markdown, set the output in the YAML header:
---
title: "Lab meeting"
output:
powerpoint_presentation:
slide_level: 2
reference_doc: my-styles.pptx
---
In R Markdown, slide_level sets the heading level that defines a slide, a horizontal rule (---) starts a slide without a header, and reference_doc supplies the style template (it needs rmarkdown 1.9 or later).
Route 3: the officer package
The officer package manipulates Word and PowerPoint documents from R: you can add images, tables and text. read_pptx() reads an initial PowerPoint file, or an empty default one, and the finished file is generated with print(). This route suits cases where slides must be assembled programmatically into an existing PowerPoint file rather than written as a Markdown document. Read the package documentation at davidgohel.github.io/officer for the functions that add slide content.
Output and how to read it
A revealjs render produces an HTML file you open in a browser; the S key opens the speaker view with your notes. A pptx render produces a PowerPoint file you open in PowerPoint or any program that reads that format. Check three things in the output: that each ## heading became one slide, that figures are the size you intended, and that tables did not split awkwardly across slides. For figure sizes, set fig.width and fig.height in the chunk options or width and height on an image (R Markdown route).
If the slides cite sources, citation handling in Quarto and R Markdown is covered in citations in Quarto, R Markdown and Pandoc.
Troubleshooting
- R Markdown PowerPoint will not render. The R Markdown PowerPoint output needs Pandoc 2.0.5 or later and rmarkdown 1.9 or later. The R Markdown book notes that the Pandoc 1.19.2.1 bundled with RStudio 1.1.x is not sufficient.
- An image or table sits on its own slide. In R Markdown PowerPoint output, images and tables always go on new slides; only the slide header and a caption can share a slide with an image or table. Text followed by an image moves the image to a new slide.
- Your template layouts are ignored (Quarto pptx). Check that the template has the seven layout names listed above. Missing ones fall back to the default reference document with a warning.
- A diagram does not appear in revealjs speaker notes. Content inside speaker notes cannot rely on external dependencies such as mermaid.js, so a Mermaid diagram in notes must be embedded as SVG or PNG.
- Too many or too few slides. Check the heading level:
##starts a slide by default, andslide-level(Quarto) orslide_level(R Markdown) changes that.
Free alternatives
All three routes above are R-based. The table summarises where each fits, using only what the official documentation states.
| Option | Use it when | Documented behaviour |
|---|---|---|
| Quarto revealjs | You want HTML slides with built-in themes and speaker view | Default theme applied automatically; theme option to switch; S key opens speaker view |
| Quarto pptx | You need a PowerPoint file in an institutional template | reference-doc template; layouts chosen from content |
| R Markdown powerpoint_presentation | You already have an R Markdown workflow | slide_level and reference_doc options; images and tables get their own slides |
| officer | You are generating or editing PowerPoint files from R code | Reads an initial or empty PowerPoint file; writes with print(); MIT + file LICENSE |
FAQ
Can I make a PowerPoint from R?
Yes. Quarto (format: pptx), R Markdown (powerpoint_presentation) and the officer package all produce PowerPoint files from R.
How do I add speaker notes?
In Quarto, wrap the notes in a ::: {.notes} div. In revealjs output, press the S key to open the speaker view. In Quarto PowerPoint output, a slide that contains only notes uses the Blank layout.
Do I need Quarto, or is R Markdown enough?
R Markdown can produce PowerPoint; the revealjs HTML slide format described here is a Quarto format. Quarto can render most existing R Markdown files without modification.
Can I use my institution’s slide template?
Yes, for PowerPoint output: reference-doc in Quarto and reference_doc in R Markdown point to a template file. For revealjs, use the theme option.
Sources (official documentation, checked 2026-10-29)
- Quarto, Presentations: https://quarto.org/docs/presentations/ (checked 2026-10-29)
- Quarto, Revealjs: https://quarto.org/docs/presentations/revealjs/ (checked 2026-10-29)
- Quarto, PowerPoint: https://quarto.org/docs/presentations/powerpoint.html (checked 2026-10-29)
- Quarto, Using R (rendering): https://quarto.org/docs/computations/r.html (checked 2026-10-29)
- R Markdown: The Definitive Guide, PowerPoint presentation: https://pkg.yihui.org/rmarkdown-book/powerpoint-presentation (checked 2026-10-29)
- officer documentation: https://davidgohel.github.io/officer/ (checked 2026-10-29)








