Slide Presentations

R Markdown renders to four presentation formats:

  • beamer_presentation - PDF presentations with beamer
  • ioslides_presentation - HTML presentations with ioslides
  • slidy_presentation - HTML presentations with slidy
  • powerpoint_presentation - PowerPoint presentation
  • revealjs::revealjs_presentation - HTML presentations with reveal.js

Each format will intuitively divide your content into slides, with a new slide beginning at each first or second level header.

Insert a horizontal rule ( *** ) into your document to create a manual slide break. Create incremental bullets with >- , as in the .Rmd file below, which is available here on RStudio Cloud.

r markdown presentation slides

Continue to Dashboards

R-bloggers

R news and tutorials contributed by hundreds of R bloggers

Enhance your storytelling – interactive slide decks with rmarkdown.

Posted on April 5, 2021 by Business Science in R bloggers | 0 Comments

[social4i size="small" align="align-left"] --> [This article was first published on business-science.io , and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here ) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This article is part of a R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks.

Slide Decks are so important for storytelling in business. We can use Rmarkdown to tell our story with engaging interactivity thanks to the xaringan library. Here’s how to make PowerPoint-style Slide Presentations that are interactive straight from R.

Here are the links to get set up. ?

  • Get the Code
  • YouTube Tutorial

r markdown presentation slides

RMarkdown can make Interactive Presentations

Slide Decks are so important for storytelling in business. We can use Rmarkdown to tell our story with engaging interactivity thanks to the xaringan library. Here’s how to make PowerPoint-style Slide Presentations that are interactive straight from R.

r markdown presentation slides

Get started with Xaringan Presentations

The easiest way is to take 10-minutes and watch the YouTube video . Here are quick parts that you’ll especially enjoy.

  • Rmarkdown Capabilities – Why Interactive Slides are Powerful
  • Adding Interactive Maps – Leaflet
  • Interactive Time Series – Timetk

r markdown presentation slides

Tip – Infinite Moon Reader (Very Useful)

The most important part is to set up the Moon Reader (Code & Moon Reader Setup). This RStudio Addin helps you load presentation changes on the fly, which enhances your productivity when making edits by automatically updating the Xaringan slides.

r markdown presentation slides

Make Slides

Slides are made with Rmarkdown code . By examining the code structure, we can see how markdown gets converted into a slide.

Here is the code:

r markdown presentation slides

…that produces this slide:

r markdown presentation slides

Add Interactive Plots and Maps

The best part of markdown is the ability to add interactivity to HTML documents. With Xaringan, we can add this interactivity to HTML Slide Decks . We can add:

  • Interactive Maps
  • Interactive Time Series Plots
  • Interactive Data Tables

r markdown presentation slides

Learning Rmarkdown

To make powerful reports and slide-decks that tell your story, you’ll need to learn rmarkdown . Here are a few learning tips.

Pro Tip 1 – Use the Cheat Sheet

Making interactive PowerPoint-Style slide decks with Rmarkdown is super simple if you know Rmarkdown. Rmarkdown is an 80/20 tool shown on the first page of my Ultimate R Cheat Sheet . When you download the cheatsheet, you get access to the entire ecosystem of R packages.

Click the “CS” next to Rmarkdown.

r markdown presentation slides

Clicking the “CS” opens the Rmarkdown Cheat Sheet. Now you’re ready to begin learning Rmarkdown.

r markdown presentation slides

PRO TIP 2 – Learn Rmarkdown in my Business Analysis with R Course

It might be difficult to learn Rmarkdown on your own. I have a course that walks you through the entire process from analysis to reporting.

The R for Business Analysis 101 Course is the first course in my R-Track program . You’ll make a two reports:

  • Customer Segmentation Report
  • Product Pricing Estimation and Gap Analysis

Here’s the Customer Segmentation Report.

r markdown presentation slides

You just built an amazing Interactive Slide Deck all thanks to `RMarkdown` and `Xaringan`!! Congratulations.

  • Interactive Principal Component Analysis in R
  • How to Forecast with ARIMA Models in R
  • Automate Excel in R
  • Detect Relationships with Linear Regression

To leave a comment for the author, please follow the link and comment on their blog: business-science.io . R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job . Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Copyright © 2022 | MH Corporate basic by MH Themes

Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts. (You will not see this message again.)

Presentations with Slidy

To create a Slidy presentation from R Markdown you specify the slidy_presentation output format in the front-matter of your document. You can create a slide show broken up into sections by using the ## heading tag (you can also create a new slide without a header using a horizontal rule ( ---- ). For example here’s a simple slide show:

Display Modes

The following single character keyboard shortcuts enable alternate display modes:

  • 'C' Show table of contents
  • 'F' Toggles the display of the footer
  • 'A' Toggles display of current vs all slides (useful for printing handouts)
  • 'S' Make fonts smaller
  • 'B' Make fonts larger

Incremental Bullets

You can render bullets incrementally by adding the incremental option:

If you want to render bullets incrementally for some slides but not others you can use this syntax:

Appearance and Style

There are several options that control the appearance of Slidy presentations:

highlight specifies the syntax highlighting style. Supported styles include “default”, “tango”, “pygments”, “kate”, “monochrome”, “espresso”, “zenburn”, and “haddock”. Pass null to prevent syntax highlighting.

smart indicates whether to produce typographically correct output, converting straight quotes to curly quotes, --- to em-dashes, -- to en-dashes, and ... to ellipses. Note that smart is enabled by default.

For example:

You can use the font_adjustment option to increase or decrease the default font size (e.g. -1 or +1) for the entire presentation. For example:

If you want to decrease the text size on an individual slide you can use the .smaller slide attribute. For example:

If you want to increase the text size on an indvidual slide you can use the .bigger slide attribute. For example:

You can also manually adjust the font size during the presentation using the ‘S’ (smaller) and ‘B’ (bigger) keys.

You can add your own CSS to a Slidy presentation using the css option:

You can also target specific slides or classes of slice with custom CSS by adding ids or classes to the slides headers within your document. For example the following slide header:

Would enable you to apply CSS to all of it’s content using either of the following CSS selectors:

Footer Elements

You can add a countdown timer to the footer of your slides using the duration option (duration is specified in minutes). For example:

You can also add custom footer text (e.g. organization name and/or copyright) using the footer option. For example:

Printing and PDF Output

You can print a Slidy presentation from within browsers that have good support for print CSS (i.e. as of this writing Google Chrome has the best support). Printing maintains most of the visual styles of the HTML version of the presentation.

To create a PDF version of a presentation you can use Print to PDF from Google Chrome.

Figure Options

There are a number of options that affect the output of figures within Slidy presentations:

fig_width and fig_height can be used to control the default figure width and height (7x5 is used by default)

fig_retina Specifies the scaling to perform for retina displays (defaults to 2, which currently works for all widely used retina displays). Note that this only takes effect if you are using knitr >= 1.5.21. Set to null to prevent retina scaling.

fig_caption controls whether figures are rendered with captions

dev controls the graphics device used to render figures (defaults to png)

Data Frame Printing

You can enhance the default display of data frames via the df_print option. Valid values include:

MathJax Equations

By default MathJax scripts are included in Slidy presentations for rendering LaTeX and MathML equations. You can use the mathjax option to control how MathJax is included:

Specify “default” to use an https URL from the official MathJax CDN.

Specify “local” to use a local version of MathJax (which is copied into the output directory). Note that when using “local” you also need to set the self_contained option to false.

Specify an alternate URL to load MathJax from another location.

Specify null to exclude MathJax entirely.

For example, to use a local copy of MathJax:

To use a self-hosted copy of MathJax:

To exclude MathJax entirely:

Document Dependencies

By default R Markdown produces standalone HTML files with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. This means you can share or publish the file just like you share Office documents or PDFs. If you’d rather have keep depenencies in external files you can specify self_contained: false . For example:

Note that even for self contained documents MathJax is still loaded externally (this is necessary because of it’s size). If you want to serve MathJax locally then you should specify mathjax: local and self_contained: false .

One common reason keep dependencies external is for serving R Markdown documents from a website (external dependencies can be cached separately by browsers leading to faster page load times). In the case of serving multiple R Markdown documents you may also want to consolidate dependent library files (e.g. Bootstrap, MathJax, etc.) into a single directory shared by multiple documents. You can use the lib_dir option to do this, for example:

Advanced Customization

Keeping markdown.

When knitr processes an R Markdown input file it creates a markdown (md) file which is subsequently tranformed into HTML by pandoc. If you want to keep a copy of the markdown file after rendering you can do so using the keep_md option:

You can do more advanced customization of output by including additional HTML content or by replacing the core pandoc template entirely. To include content in the document header or before/after the document body you use the includes option as follows:

Custom Templates

You can also replace the underlying pandoc template using the template option:

Consult the documentation on pandoc templates for additional details on templates. You can also study the default HTML template as an example.

Markdown Extensions

By default R Markdown is defined as all pandoc markdown extensions with the following tweaks for backward compatibility with the markdown package:

You can enable or disable markdown extensions using the md_extensions option (you preface an option with - to disable and + to enable it). For example:

The above would disable the autolink_bare_uris extension and enable the hard_line_breaks extension.

For more on available markdown extensions see the pandoc markdown specification .

Pandoc Arguments

If there are pandoc features you want to use that lack equivilants in the YAML options described above you can still use them by passing custom pandoc_args . For example:

Documentation on all available pandoc arguments can be found in the pandoc user guide .

Shared Options

If you want to specify a set of default options to be shared by multiple documents within a directory you can include a file named _output.yaml within the directory. Note that no YAML delimeters or enclosing output object are used in this file. For example:

_output.yaml

All documents located in the same directory as _output.yaml will inherit it’s options. Options defined explicitly within documents will override those specified in the shared options file.

  • United States
  • United Kingdom

How to create PowerPoint slides from R

Learn how to generate powerpoint slides straight from an r markdown document. plus, create interactive html slides in r with the xaringan package..

Executive Editor, Data & Analytics, InfoWorld |

How to create PowerPoint slides from R

There are lots of ways to share results of your R analysis: Word documents , interactive apps , even in the body of an email .

But sometimes, you want a slide presentation. It’s easy to generate a PowerPoint file from your R code – complete with charts and graphs – directly from an R Markdown document.

Create a PowerPoint from R Markdown

To create a PowerPoint from R, you need three things on your system:

  • PowerPoint or OpenOffice,
  • The rmarkdown package, version 1.9 or later, and
  • Pandoc version 2.0.5 or newer.

Pandoc isn’t an R package. It’s not R at all; it’s a separate piece of open source software designed for file format conversions.

RStudio ships with Pandoc, so you probably have a version of it installed if you use RStudio. You can run the rmarkdown package’s pandoc_version() function to see if you’ve got it installed and, if so, what version. If your pandoc is too old, try updating RStudio (or install pandoc directly from pandoc.org ).

There is an option to create a PowerPoint file from R Markdown when you create a new markdown file in RStudio.

Next, create an R Markdown document. If you do that from RStudio’s menu with File > New File > R Markdown, you’ll have a few choices . If you click on the second choice, Presentation, you should see an option for PowerPoint under Default Output Format.

The resulting R Markdown file created by RStudio includes examples for mixing text and R code results. If you save that file and then “knit” it by clicking the knit button in RStudio, you'll get a PowerPoint presentation with the same information.

How did R know where to break the content into new slides? The default is “the highest level of headline that’s not followed immediately by another headline.” In this case that’s headline level two, or all titles starting with ## .

You don’t need to use that default rule, though. You can specify another headline level to auto-divide your document into new slides. That’s done in the doc’s YAML header  with the slide_level option, such as

But if you don’t want to fiddle with all that, you can divide content into new slides manually with three dashes. Make sure the three dashes are on a completely new line.

Presenting the weather

Here is an R Markdown file that’s a bit more interesting than the default doc, at least for me: One with weather data.

Notice the R chunk options I’ve set.  echo = FALSE  means my R code won’t show up in my slides. warning and message set to FALSE makes sure any warnings or messages from my code don’t appear in the slides either. I’ve also set a default figure width and cache = TRUE  . (I don’t usually cache results for a file I want to update regularly, but I did so to save time on the accompanying video.)

Get National Weather Service forecast data via R

My R Markdown setup code chunk also sources a separate file on GitHub that includes two functions for fetching weather data. Here is that code, if of interest:

The first function pulls a forecast data frame from the National Weather Service API using the city name and the city’s forecast URL as function arguments. 

You need to know the API’s forecast URL for a location in order to get its forecast data. If you don’t know that URL, you can get it from another National Weather Service API using the format 

The initial API result from the httr GET request is a list. The function adds code that returns only the portion of the list with the data I want, formatted as a data frame.

The second function takes that forecast data frame and generates a ggplot line graph for high and low temperatures.

Change the PowerPoint default font

If you want a different default font or font size for your R-generated slides, you can set those with a reference PowerPoint document and add info about that document in the R Markdown YAML header. I did that for these slides, as you can see in this portion of the YAML document header:

My reference file, CorporateStyle.pptx ,  is a regular PowerPoint file and not a PowerPoint template. To turn it into a reference file, I went into the file’s Master Slide view and set some styles. You can edit any PowerPoint file’s Master Slide view in the PowerPoint menu with View > Slide Master.

Whenever I want an updated version of that forecast PowerPoint, I just need to re-knit the document. I could even set this up to run automatically using Windows scheduler or launchd on a Mac.

Create HTML slides from R

There might be many times when you specifically need or want a PowerPoint file. One thing PowerPoint slides lack, though, is interactivity. For example, you can’t roll over a graph and see underlying data.

You could if these were HTML slides, though.

There are a few ways to generate HTML slides from R. One of the most popular is with the xaringan R package . xaringan is built on top of the remark.js JavaScript library. There is a bit of a learning curve to do more than the basics, but the look and feel are extremely customizable.

xaringan would need its own series to cover all you can do with it. But even basics can work for a lot of use cases. Below is an example of an R Markdown document with just a bit of customization.

Three dashes create a new slide. That first slide after the title slide won’t display; it’s setting defaults for the other slides. layout: true means “this is a slide setting up layout defaults.” class: center centers everything – header text, graphics – unless I specifically code it otherwise. 

The xaringan::moonreader output option regenerates the slides each time you save the file so you don’t need to click the knit button. 

The body of the file includes a graphing function I wrote using one of my favorite dataviz packages, echarts4r , to visualize my weather data. You can hover over lines on the graphs in these slides to see underlying data, as well as click legend items to turn lines off and on.

An HTML slide presentation lets you interact with visualizations, such as hovering over a graph to see underlying data.

There is a ton more you can do with xaringan, from adding your own CSS file to creating your own theme to animating slides. Here are some resources to learn more:

  • xaringan slide presentation about xaringan by creator Yihui Xie
  • Incremental slides with xaringan by creator Yihui Xie
  • xaringan presentations from R Markdown: the Definitive Guide by Yihui Xie, J. J. Allaire, and Garrett Grolemund
  • xaringan gallery of examples and themes by Emil Hvitfeldt
  • Meet xaringan: Making slides in R Markdown by Alison Hill (RStudio Conference 2019 workshop slides)
  • xaringanExtra package (enhancements and extensions to the xaringan package) by Garrick Aden-Buie
  • xaringanthemer package (lots of xaringan styling options)  by Garrick Aden-Buie

And for more R tips, head to the Do More With R page .

Next read this:

  • Why companies are leaving the cloud
  • 5 easy ways to run an LLM locally
  • Coding with AI: Tips and best practices from developers
  • Meet Zig: The modern alternative to C
  • What is generative AI? Artificial intelligence that creates
  • The best open source software of 2023
  • Business Intelligence
  • Data Visualization

Sharon Machlis is Director of Editorial Data & Analytics at Foundry, where she works on data analysis and in-house editor tools in addition to writing. Her book Practical R for Mass Communication and Journalism was published by CRC Press. She was named Digital Analytics Association's 2021 Top (Data) Practitioner, winner of the 2023 Jesse H. Neal journalism award for best instructional content, 2014 Azbee national gold award for investigative reporting, and 2017 Azbee gold for how-to article, among other awards. You can find her on Mastodon at masto.machlis.com/@smach .

Copyright © 2022 IDG Communications, Inc.

r markdown presentation slides

Making HTML Slides with the markdown Package

1. get started, 2.1 example ( --- ), 2.2 example ( ## ), 3. keyboard shortcuts, 4.1 example: section numbers, 4.2 example: toc, 4.3 responsive layout, 4.4 printing, 5.1 built-in classes, 5.2 example: an inverse slide, 5.3 example: center content, 5.4 example: fade a slide, 5.5 example: a background image, 5.6 example: an editable slide, 6.1 page numbers, 7.1 lengthy slides, 7.2 aspect ratio, 8.1 the original html, 8.2 snap.js, 8.3 snap.css.

Specify at least one CSS file ( snap.css ) and one JS script ( snap.js ) in YAML metadata:

You will learn more about snap.css and snap.js at the end of this presentation.

Equivalently, you can specify them in the arguments of markdown::mark_html() :

but I recommend that you specify these options in YAML metadata instead.

2. Create slides

There are two ways to create a new slide:

  • Insert a horizontal rule ( --- ).
  • Or use the level-two section heading ( ## ).

You must choose only one way, i.e., either use horizontal rules to separate all slides, or avoid horizontal rules but only use section headings.

The first way is more flexible—you don’t have to start a slide with a section heading.

f : Fullscreen mode (press Esc to exit). The scroll bar will be hidden in the fullscreen mode. You can also use the keyboard shortcut of your browser, e.g., fn + F in Chrome on macOS.

o : Overview mode

Slides become thumbnails, to make it easier to glance over multiple slides at once.

Press o again to go back to presentation mode.

Alternatively, you can click on a slide while holding the Alt key to toggle the overview mode and navigate to the clicked slide. Basically, Alt + Click is like zoom in/out.

m : Mirror mode

Slides are mirrored. 1

Press m again to resume.

4. CSS and styling

You can pass more CSS files to the css option, e.g., if you have extra.css under the same directory as the Markdown input file:

If your input document is .Rmd , you can also embed CSS directly in a css code chunk:

Below is a CSS code chunk in which we defined the font families for this presentation:

When the Markdown option number_sections is enabled, all sections are numbered. You can hide all numbers via CSS:

For this presentation, only section numbers for level-two headings are displayed:

If you enable the table of contents (TOC) by setting the option toc: true , you will get a TOC slide after the title slide. It uses a two-column layout by default. You can custom its styles via the CSS selector #TOC . For example, you can use three columns:

Or define the TOC title by:

Or shorten TOC (hide lower-level headings):

For this presentation, we don’t hide lower-level headings in TOC but just make them more compact ( display: inline; ):

You can resize your browser window to see the effect (also try to press o and test the overview mode). If you are on a mobile device, you should see a normal continuous page, since you cannot adjust the window size.

When the slides are printed, the font size will be reduced.

To save space, the presentation is printed as a continuous document instead of slides.

If you want borders on slides, print them from the overview mode.

To customize style for printing, you may define CSS rules in:

5. Slide attributes

You can add more attributes to a slide via an HTML comment that starts with # ( Cmd / Ctrl + Shift + C in RStudio’s visual Markdown editor), e.g.,

The syntax is just HTML. These attributes will be added to the slide container:

inverse : Apply a dark background and invert the slide color.

center : Center all elements horizontally.

middle : Center all elements vertically.

fade : Fade a slide (50% opacity) and apply grid lines to the background (can be useful for de-emphasizing a slide).

You can define your own arbitrary class names (e.g., <!--# class="large" --> ) and corresponding CSS rules (e.g., .large { font-size: 150%; } ).

The background is (nearly) black and the text is white.

The font size is 30% larger.

Everything is centered both vertically and horizontally.

Of course, you don’t have to use both classes at the same time. Depending on how you want to center content, you can use one of these classes.

This slide is not important. You do not need to read it carefully. You can even take a nap, since the speaker is boring.

We use the style attribute to introduce a background image to this slide. You can learn more about the background-image property here .

Believe it or not, this slide is editable because we have enabled the contenteditable attribute. If you find any mistake on your slide during your presentation, you can click on it and edit any text.

Note that your edits will not be saved, though.

6. Miscellaneous elements

They are placed in <span class="page-number"></span> at the bottom right of all slides.

If you click on a page number, the URL of the presentation will be appended by a hash of the form #N , where N is the page number. You can share this URL with other people when you want to point them to a specific page in the slides.

A timer is added to the bottom left in <span class="timer"></span> by default. If you want a countdown timer, you can add a custom <span> to your document (in Markdown, you can use a raw HTML block ```{=html} ), and specify the total number of seconds in the attribute data-total , e.g.,

The timer will start when the presentation becomes fullscreen. To restart the timer, click on it.

For the countdown timer, when the time is up, the timer will start to blink.

When the height of a slide exceeds the window height, you need to be careful because it can be easy to accidentally scroll to the next page as you approach the bottom of the slide.

One solution is to add more space to the bottom of the slide using the extend class.

This will add a placeholder with the class spacer to the end of the slide. This placeholder has a height of 50vh , i.e., half of the window height (you can customize it via CSS). That means as soon as the bottom of the slide reaches the middle of the screen, you will be navigated to the next slide. Be careful! If you move from an oversized slide to the next slide by accident, you will not be able to move back to the bottom of the previous slide directly! Instead, you will always be navigated to the top of the previous slide if you want to go back. When you are on a long slide, I recommend that you use your mouse wheel or the Down arrow key to scroll at small steps, instead of using the PageDown key to scroll over to the next screen at once.

Because of this hassle, you may not really want to make a slide lengthy, but it may be unavoidable when you have lengthy content to show on one slide and it cannot be broken. Below is a toy example (the output block cannot be split onto two slides):

The aspect ratio of slides is not defined by default. The content will fit all available space on the screen. If you present the slides directly with your own computer, this may not be a problem since you know if all content fits well on your own screen. However, if you connect your computer to a projector or present the slides on another computer, you’d better know the screen resolution beforehand, because the aspect ratio may be different, and your slides can look different on that screen.

You can fix the aspect ratio by setting the body width in CSS. For example, if your computer screen’s resolution is 900 × 1440, and you want the aspect ratio 4:3, you should set the body width to 1200px (= 900 × 4/3).

Or set the width to a proportion of the height. A relative value will work with any screen height, e.g., 4/3 ≈ 1.33:

However, note that when the presentation is not fullscreen, the slides will not take the full screen height (the browser UI elements such as the menu and tool bar will take some vertical space), so 133vh will be an underestimate of the width.

8. Technical notes

How does this HTML presentation work under the hood?

This can be generated from Markdown.

The script snap.js converts HTML to a structure more convenient to style as slides:

The core technique is CSS Scroll Snap . The full CSS is snap.css , and the essential rules are:

The JS and CSS code can be used outside the R package markdown , too. You just need to have the correct HTML structure. Then in your HTML document:

Remember to substitute VERSION with an appropriate version (e.g., 1.11 ). You can omit @VERSION to use the latest version but it is not recommended because future updates might break your old slides.

Both the JS and CSS are quite lightweight (total size is 8.6 Kb when uncompressed) and have no dependencies. They were written from scratch.

I developed the xaringan in package 2016 and have used it since then. It still works perfectly, but now I prefer more lightweight frameworks.

Most of presentation features that I need are included in 308 lines of JS/CSS code ( default.css / snap.js / snap.css ).

This simple presentation framework is highly customizable. Customizing slides can be addictive if you know HTML/CSS/JS.

Learn more about the Markdown syntax in vignette('intro', package = 'markdown') .

Github repo: https://github.com/rstudio/markdown (you can find the Rmd source of this presentation in the repo)

See this post for a possible application of this odd feature. ↩

How To Make A PowerPoint Presentation Using R Markdown

r markdown presentation slides

PowerPoint is the most recognized presentation-making software, but it isn’t for everyone. Some may find it packed with unnecessary features, and to some extent that's true. Microsoft updates it regularly and invents things you never even knew you needed. If you’re a programmer at heart, you likely value simplicity. That’s where this article comes in. We’ll ditch PowerPoint and make presentations in a way you didn’t know was possible. After reading, you’ll know how to make an entire editable PowerPoint presentation using only R Markdown. <blockquote><strong>Interested in a real-world use case? <a href="https://appsilon.com/gxp-compliance-in-pharma-made-easier-good-documentation-practices-with-r-markdown-and-officedown/" target="_blank" rel="noopener noreferrer">Here’s how we applied R Markdown in Pharma</a>.</strong></blockquote> Table of contents: <ul><li><a href="#getting-started">Getting Started</a></li><li><a href="#basics">What Can You Do With Markdown?</a></li><li><a href="#advanced">Images, Tables, and Custom Layout</a></li><li><a href="#style">How to Style Your R Markdown Presentation</a></li><li><a href="#conclusion">Conclusion</a></li></ul> <hr /> <h2 id="getting-started">R Markdown PowerPoint Presentation - Getting Started</h2> We assume you have R and RStudio installed. Once in RStudio, go to <em>File</em> - <em>New File</em> - <em>R Markdown</em>. A window like the one below should appear: <img class="size-full wp-image-12097" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ee7832c47d67312b3e1_creating-new-r-markdown-powerpoint-presentaiton.webp" alt="Image 1 - Creating a new R Markdown PowerPoint Presentation" width="2564" height="1758" /> Image 1 - Creating a new R Markdown PowerPoint Presentation Give your presentation a title and optionally specify the author. Also, make sure to select <em>PowerPoint</em> as the default output format. R will ask you to install a couple of dependencies if this is your first time working with R Markdown. After clicking on OK you’ll see a default R Markdown PowerPoint presentation code: <img class="size-full wp-image-12099" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ee892a26c843b62e764_Default-presentation-template.webp" alt="Image 2 - Default presentation template" width="2564" height="1758" /> Image 2 - Default presentation template That’s great, but how can you “compile” it? Well, easily! Click on the <strong>Knit dropdown</strong> and choose the <em>Knit to PowerPoint</em> option: <img class="size-full wp-image-12107" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eea48b83fcd2e55b400_How-to-run-R-Markdown-PowerPoint-presentation.webp" alt="Image 3 - How to run R Markdown PowerPoint presentation" width="2564" height="1758" /> Image 3 - How to run R Markdown PowerPoint presentation That’s it! A PowerPoint presentation will be knitted and opened after a couple of seconds. Here’s what it looks like: <img class="size-full wp-image-12105" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eea2a228de4b21e9ac2_First-rendered-presentation.gif" alt="Image 4 - First rendered presentation" width="1314" height="898" /> Image 4 - First rendered presentation It’s a strong start but definitely needs work. I'll show you how to spice it up in the sections below. First, we’ll explore what can you actually do with Markdown. <h2 id="basics">What Can You Do With Markdown?</h2> Markdown is a free-to-use markup language used to format plain text. It’s popular among developers and technical writers because it provides you with everything you need and nothing else. We’ll now explore what can you do with R Markdown, and how you can do it. You’ll learn how to: <ul><li><strong>Style the text</strong> - Use italics, bold, strikeout, subscript, superscript, small caps, and verbatim.</li><li><strong>Lists</strong> - Ordered and unordered.</li><li><strong>Links</strong> - Embed URLs to external websites.</li><li><strong>Quotes</strong> - Special indentation for your text.</li><li><strong>Equations</strong> - Does LaTeX ring a bell? You can use it in Markdown.</li></ul> We’ll also cover more advanced Markdown functionality, but these are enough for one section. Use the following code to declare two slides with all mentioned Markdown functionalities: <script src="https://gist.github.com/darioappsilon/b2da95cfb87db52c2a49ba4ea3bb150a.js"></script> Your R Markdown file should look like this: <img class="size-full wp-image-12103" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eeb6bb6e6a6629bfa2b_Exploring-Markdown-options.webp" alt="Image 5 - Exploring Markdown options" width="2564" height="1758" /> Image 5 - Exploring Markdown options And once again, use <em>Knit to PowerPoint</em> option to export the PPTX: <img class="size-full wp-image-12109" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eec9506383404c4ec25_Rendered-markdown-presentation.gif" alt="Image 6 - Rendered markdown presentation" width="1314" height="898" /> Image 6 - Rendered markdown presentation The R Markdown PowerPoint presentation still looks rough around the edges, but we’ll address the visuals soon. Before we do that, let’s go over a couple of “advanced” Markdown elements, and how to get the most out of them. <blockquote><strong>Want to include your Bar Plots in your presentation? Follow these <a href="https://appsilon.com/data-visualization-best-practices-bar-plots/" target="_blank" rel="noopener noreferrer">Data Visualization Best Practices</a>.</strong></blockquote> <h2 id="advanced">Adding Images, Tables, and Custom Layouts to an R Markdown PowerPoint Presentation</h2> A presentation without images and tables is, well, boring. Also, most presentations make use of multiple layouts. For example, there are scenarios where a two-column layout is preferred. You’ll learn how to use it in this section. The code snippet below implements the following: <ul><li><strong>1st Slide</strong> - Loads a dog image from <a href="https://unsplash.com/photos/UinXDJCcqeY" target="_blank" rel="noopener noreferrer">Unsplash</a> and adds a caption to it.</li><li><strong>2nd Slide</strong> - Shows a table representing a subset from the <a href="https://gist.github.com/netj/8836201" target="_blank" rel="noopener noreferrer">Iris dataset</a>.</li><li><strong>3rd Slide</strong> - Implements a two-column layout.</li></ul> <script src="https://gist.github.com/darioappsilon/37a7b72b33753d95fa4553f0c968dd98.js"></script> This time, you won’t see any rendered output in the R Markdown file: <img class="size-full wp-image-12095" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eed00b05468d71b8f4e_Adding-images-tables-and-custom-layouts.webp" alt="Image 7 - Adding images, tables, and custom layouts" width="2564" height="1758" /> Image 7 - Adding images, tables, and custom layouts Here’s what the final PPTX looks like: <img class="size-full wp-image-12111" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01eefe6755ca41b304f53_Rendered-Powerpoint-presentation.gif" alt="Image 8 - Rendered Powerpoint presentation" width="1314" height="898" /> Image 8 - Rendered Powerpoint presentation You now know the basics of R Markdown - just enough to place any type of content into your R Markdown PowerPoint presentations. But how can you make the slideshow visually appealing? That’s what we’ll explore next. <h2 id="style">How to Style Your R Markdown PowerPoint Presentation</h2> The default PPTX layout is, well, default, and doesn’t look attractive at all. To change it, you’ll first have to create a blank PowerPoint presentation and open the Slide Master (<em>View - Slide Master</em>). Once inside, tweak it as you normally would when styling a PPTX file. <blockquote><strong>Excel is good, but not great. Check out our <a href="https://appsilon.com/excel-is-obsolete-here-are-the-top-2-alternatives-from-r-and-python/" target="_blank" rel="noopener noreferrer">top alternatives from R and Python</a>. </strong></blockquote> We’ll only change the theme, just to keep things simple: <img class="size-full wp-image-12101" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ef20a2ba062e1ba27da_Editing-the-slide-master.webp" alt="Image 9 - Editing the slide master" width="3100" height="2024" /> Image 9 - Editing the slide master You’re free to take your time here and add custom graphics, fonts, and other visual elements. Once done, <strong>save the PPTX file right where your .Rmd file is</strong>: <img class="size-full wp-image-12115" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ef40fc7bbb4c493e2d2_Saving-PowerPoint-template.webp" alt="Image 10 - Saving PowerPoint template" width="3424" height="2024" /> Image 10 - Saving PowerPoint template You can save it elsewhere, but it’s a good practice to keep the PowerPoint template and R Markdown file in the same directory. To use the template, you’ll only have to modify the header of the R Markdown file: <script src="https://gist.github.com/darioappsilon/f1b601dd3efaf3faa2e21ea06cf9c475.js"></script> That’s why we saved the PPTX template in the same directory. There’s no need to think about the path. Everything else in the Rmd file remains the same. Knit the PowerPoint presentation to verify the template was used: <img class="size-full wp-image-12113" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ef4385c8d506b9c0ed3_Rendered-presentation-with-a-custom-template.gif" alt="Image 11 - Rendered presentation with a custom template" width="1314" height="898" /> Image 11 - Rendered presentation with a custom template And would you look at that - a custom PowerPoint template was successfully applied to our R Markdown PowerPoint presentation. We won’t dive into more advanced use cases today, as this alone is enough to cover what most programmers and tech users need. But if you'd like to learn about more advanced uses, let us know. <h2 id="conclusion">Conclusion</h2> PowerPoint isn’t for everyone, just like MS Word. If you know Markdown, you can write and edit text documents much faster than in a traditional word processor. What makes things even better is its shareability, as most online writing platforms understand Markdown. R Markdown is by no means a replacement for dedicated office suites, so keep that in mind. It might be a decent alternative if you need to automate slide production, simply don’t want to use PowerPoint, or if you don’t need all the functionalities it offers. To further drive the point home, we recommend the following homework tasks: <ul><li>Try to embed a YouTube video or a GIF. Is there any difference from regular images?</li><li>Add presenter notes to one or more slides.</li><li>Try to add animations between slides. Is it possible?</li></ul> Feel free to share results with us on Twitter – <a href="https://twitter.com/appsilon" target="_blank" rel="noopener noreferrer">@appsilon</a>. We’d love to see what you come up with. <blockquote><strong>R isn’t limited to Markdown only. <a href="https://appsilon.com/best-r-shiny-books-and-courses/" target="_blank" rel="noopener noreferrer">Here are the top free resources if you want to learn R Shiny</a>.</strong></blockquote>

Contact us!

Damian's Avatar

Read about simillar topics

R Shiny Highcharts

R Shiny Highcharts - How to Create Interactive and Animated Shiny Dashboards

r markdown presentation slides

R Highcharts Drilldown - How to Create Animated and Interactive Drilldown Charts in R

R Highcharts: How to Make Animated and Interactive Data Visualizations in R

R Highcharts: How to Make Animated and Interactive Data Visualizations in R

Take your business further with custom data solutions.

Unlock the full potential of your enterprise with our data services, tailored to the unique needs of Fortune 500 companies. Elevate your strategy—connect with us today!

r markdown presentation slides

Make PowerPoint Presentations with R Markdown

r markdown presentation slides

November 30, 2018

About the speaker

Nathan stephens.

Nathan has a background in analytic solutions and consulting. He has experience building data science teams, architecting analytic infrastructure, and delivering innovative data products. He is a long time user of R.

  • More by Nathan Stephens

presentations

R Markdown: The Definitive Guide

Chapter 8 reveal.js presentations.

The revealjs package ( El Hattab and Allaire 2017 ) provides an output format revealjs::revealjs_presentation that can be used to create yet another style of HTML5 slides based on the JavaScript library reveal.js . You may install the R package from CRAN:

To create a reveal.js presentation from R Markdown, you specify the revealjs_presentation output format in the YAML metadata of your document. You can create a slide show broken up into sections by using the # and ## heading tags; you can also create a new slide without a header using a horizontal rule ( --- ). For example, here is a simple slide show:

See Figure 8.1 for two sample slides.

Two sample slides created from the revealjs package.

FIGURE 8.1: Two sample slides created from the revealjs package.

IMAGES

  1. presentation in r markdown

    r markdown presentation slides

  2. How to make a Powerpoint Slide/Presentation using R Markdown (RStudio) in 2020

    r markdown presentation slides

  3. R Markdown PowerPoint Slide Customization

    r markdown presentation slides

  4. R Markdown slides part 2 of 6

    r markdown presentation slides

  5. How To Make A PowerPoint Presentation Using R Markdown

    r markdown presentation slides

  6. 40 Reports with R Markdown

    r markdown presentation slides

VIDEO

  1. How to create html presentations with markdown files

  2. How to Create PowerPoint Presentations using RMarkdown and officer package in R

  3. Introduction to R Markdown

  4. Introduction to R Markdown

  5. R Markdown을 이용한 문학적 프로그래밍

  6. Markdown Presentation

COMMENTS

  1. Slide Presentations

    R Markdown renders to four presentation formats: Each format will intuitively divide your content into slides, with a new slide beginning at each first or second level header. Insert a horizontal rule ( ***) into your document to create a manual slide break. Create incremental bullets with >-, as in the .Rmd file below, which is available here ...

  2. Chapter 4 Presentations

    The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of ...

  3. 7.3 Slide formatting

    The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of ...

  4. How To Make A PowerPoint Presentation Using R Markdown

    Once in RStudio, go to File - New File - R Markdown. A window like the one below should appear: Image 1 - Creating a new R Markdown PowerPoint Presentation. Give your presentation a title and optionally specify the author. Also, make sure to select PowerPoint as the default output format.

  5. Mastering R presentations

    Then, a .RPres document is going to be created. This is the simplest, really simplest, way to start but my advice is to go quickly to the next step if you want more flexibility in the slides and final appearance. So going to. File -> New File -> R Markdown. File -> New File -> R Markdown and selecting the option.

  6. Interactive Slide Decks with Rmarkdown

    Pro Tip 1 - Use the Cheat Sheet. Making interactive PowerPoint-Style slide decks with Rmarkdown is super simple if you know Rmarkdown. Rmarkdown is an 80/20 tool shown on the first page of my Ultimate R Cheat Sheet. When you download the cheatsheet, you get access to the entire ecosystem of R packages.

  7. Presentations with Slidy

    Overview. To create a Slidy presentation from R Markdown you specify the slidy_presentation output format in the front-matter of your document. You can create a slide show broken up into sections by using the ## heading tag (you can also create a new slide without a header using a horizontal rule (----).For example here's a simple slide show:--- title: "Habits" author: John Doe date: March ...

  8. How to create PowerPoint slides from R

    To create a PowerPoint from R, you need three things on your system: PowerPoint or OpenOffice, The rmarkdown package, version 1.9 or later, and. Pandoc version 2.0.5 or newer. Pandoc isn't an R ...

  9. Making HTML Slides with the markdown Package

    Slides become thumbnails, to make it easier to glance over multiple slides at once. Press o again to go back to presentation mode. Alternatively, you can click on a slide while holding the Alt key to toggle the overview mode and navigate to the clicked slide. Basically, Alt + Click is like zoom in/out. 8/34.

  10. How To Make A PowerPoint Presentation Using R Markdown

    Once in RStudio, go to File - New File - R Markdown. A window like the one below should appear: Image 1 - Creating a new R Markdown PowerPoint Presentation Give your presentation a title and optionally specify the author. Also, make sure to select PowerPoint as the default output format.

  11. rmarkdown: Make interactive PowerPoint slide presentations in R

    Slide Decks are so important for #storytelling in business. We can use #Rmarkdown to tell our story with engaging interactivity. Here's how to make Interacti...

  12. 4.2 Slidy presentation

    4.2 Slidy presentation. To create a Slidy presentation from R Markdown, you specify the slidy_presentation output format in the YAML metadata of your document. You can create a slide show broken up into sections by using the ## heading tag (you can also create a new slide without a header using a horizontal rule (---).For example, here is a simple slide show (see Figure 4.2 for two sample slides):

  13. Make PowerPoint Presentations with R Markdown

    November 30, 2018. Data scientists use R Markdown documents to create reproducible code that can be rendered in a variety of output types. Some of the most common output types include HTML, Word, and PDF, but new improvements make it possible to create PowerPoint presentations as well.

  14. R Markdown PowerPoint Slide Customization

    I'm reading R Studio's guide to creating PowerPoint presentations in R Markdown. I'd like to be able to customize my slides to include two things: Stretch the image size to the full width of the slide; Move the title up a bit and left align it; After doing some internet searches I just can't determine how to do this properly. Maybe you know how.

  15. Rendering PowerPoint Presentations with the RStudio IDE

    Getting Started. To create a PowerPoint presentation, open a new R Markdown PowerPoint presentation or specify powerpoint_presentation as an output format in the YAML header. New File > R Markdown > Presentation > PowerPoint. When you knit an R Markdown document, RStudio renders your document in the PowerPoint output format.

  16. 9 Presentations in R markdown

    9. Presentations in R markdown. There are several schemes for making presentations with R markdown. I like to use the xaringan package (others include ioslides and beamer). To make an xaringan presentation, install the package then (after restarting RStudio) go to File > New File > R Markdown > From Template > Ninja Presentation.

  17. presentations

    Getting started with R Markdown; Getting Started with Quarto by RStudio: A Beginner's Guide

  18. R Markdown: The Definitive Guide

    The first official book authored by the core R Markdown developers that provides a comprehensive and accurate reference to the R Markdown ecosystem. With R Markdown, you can easily create reproducible data analysis reports, presentations, dashboards, interactive applications, books, dissertations, websites, and journal articles, while enjoying the simplicity of Markdown and the great power of ...

  19. OutlineSpark: Igniting AI-powered Presentation Slides Creation from

    Moreover, they were familiar with creating slides for presentation, with frequency of 1 to 5 times per week. 6.2 Task. In our user study, inspired by the task in Slide4N and NB2Slides , participants were required to create a slide deck for a 10-minute presentation. They were told that the target audiences could be business or technical ...

  20. 4.1 ioslides presentation

    4.1 ioslides presentation. To create an ioslides presentation from R Markdown, you specify the ioslides_presentation output format in the YAML metadata of your document. You can create a slide show broken up into sections by using the # and ## heading tags (you can also create a new slide without a header using a horizontal rule (---).For example here is a simple slide show (see Figure 4.1 for ...

  21. Chapter 8 reveal.js Presentations

    To create a reveal.js presentation from R Markdown, you specify the revealjs_presentation output format in the YAML metadata of your document. You can create a slide show broken up into sections by using the # and ## heading tags; you can also create a new slide without a header using a horizontal rule (---).For example, here is a simple slide show: