How To Make A PowerPoint Presentation Using R Markdown

presentation in rmarkdown

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

Shiny for Python Shinylive: How to Run Shiny for Python Apps Without a Python Server

Shiny for Python Shinylive: How to Run Shiny for Python Apps Without a Python Server

presentation in rmarkdown

R Dplyr vs. DuckDB - How to Enhance Your Data Processing Pipelines with R DuckDB

R Shiny Highcharts

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

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-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

presentation in rmarkdown

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.

presentation in rmarkdown

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

presentation in rmarkdown

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.

presentation in rmarkdown

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:

presentation in rmarkdown

…that produces this slide:

presentation in rmarkdown

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

presentation in rmarkdown

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.

presentation in rmarkdown

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

presentation in rmarkdown

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.

presentation in rmarkdown

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.)

  • Get started
  • About Lua filters
  • Version 2.7
  • Version 2.6

Convert to a PowerPoint presentation

Format for converting from R Markdown to a PowerPoint presentation. Pandoc v2.0.5 or above is required.

TRUE to include a table of contents in the output

Depth of headers to include in table of contents

TRUE to number section headings

TRUE to render slide bullets incrementally. Note that if you want to reverse the default incremental behavior for an individual bullet you can precede it with > . For example: > - Bullet Text . See more in Pandoc's Manual

Default width (in inches) for figures

Default height (in inches) for figures

TRUE to render figures with captions

Method to be used for printing data frames. Valid values include "default", "kable", "tibble", and "paged". The "default" method uses a corresponding S3 method of print , typically print.data.frame . The "kable" method uses the knitr::kable function. The "tibble" method uses the tibble package to print a summary of the data frame. The "paged" method creates a paginated HTML table (note that this method is only valid for formats that produce HTML). In addition to the named methods you can also pass an arbitrary function to be used for printing data frames. You can disable the df_print behavior entirely by setting the option rmarkdown.df_print to FALSE . See Data frame printing section in bookdown book for examples.

Keep the markdown file generated by knitting.

Markdown extensions to be added or removed from the default definition of R Markdown. See the rmarkdown_format for additional details.

The heading level which defines individual slides. By default this is the highest header level in the hierarchy that is followed immediately by content, and not another header, somewhere in the document. This default can be overridden by specifying an explicit slide_level .

Path to a PowerPoint template.

Additional command line options to pass to pandoc

R Markdown output format to pass to render()

Making a Presentation in R: Getting started

Many of us have faced this dilemma: it’s the night before a big presentation and you want to make sure you are prepared. However, as you are going through the slides, you notice there is an error in your analyses and you need to update the results on ALL of your slides. So the night before this big presentation, you end up spending more time trying to manually update the slides one by one than preparing for the presentation itself. As someone who is always searching for ways to automate the manual, error-prone parts of my work so I can spend more time on the important things, I was delighted to learn that there is an option to reduce some of the burden of creating and updating slides by creating presentations in R. In this post, along with ones to follow, I’ll walk through how to do this. First, I’ll highlight some of the biggest benefits of learning how to create presentations in R.

If you use R to run your analyses, you can easily integrate your graphics & results into your presentation. Instead of having to manually copy and paste the results of your statistical test or the output from ggplot, you can simply write a line of code or two to add those into your presentation. More notably, this means that if you need to update the slides in the future, you will be able to do so painlessly - instead of having to go in slide-by-slide and updating each.

With R, you’ll spend less time spent messing around with formatting. For instance, let’s say I want to have all of the images on my slides to be a certain size. It’s much easier to make those changes using code compared to setting the image size one each slide manually

Now that I’ve hopefully convinced you of the benefits of using R for presentations, you may be wondering…

What options do I have to make presentations in R?

xaringan presentations

reveal.js presentations

ioslides presentations

beamer presentations

slidy presentations

good old powerpoint presentations

I decided to go with xaringan because I’ve been a fan of Yihui Xie’s (creator of the xaringan package) work with other packages and was also persuaded by this post where he explains why he prefers remark.js (which is used behind the scenes to render the presentation) for xaringan presentations over other presentation frameworks. The rest of this post will be focused on setting up a presentation using the xaringan package.

To be able to create a new xaringan template, we need to install the xaringan package using install.packages("xaringan")

Once xaringan is installed, you can create the new template from the drop-down menu on RStudio (assuming you are using RStudio): File -> RMarkdown. A new window should appear, with four possible options for creating the new RMarkdown file: “Document,” “Presentation,” “Shiny,” or “From Template”. Click “From Template” and at the bottom of the list you should see “Ninja Presentation”.

Now, you should have a template slide deck that you can edit right away! Super easy. It can even be knitted immediately, which should show up right next to your code under the viewer tab - make sure to save it first!

I would highly recommend taking a few minutes to just look at the code and the presentation to see how the input affects the output.

So for instance, I immediately notice that there is a YAML header with a few unique parameters, presumably specific to xaringan. For instance, under output , the xaringan::mood_reader has the parameter highlightStyle set to “github.” Since the presentation suggests that the YAML header inputs correspond to the title slide (e.g., YAML header title is set to “Presentation Ninja”), I went ahead and changed title, author, and date for my purposes, leaving other YAML settings as they were:

So now that I’ve made those changes, I can knit again, and my title page now has my name, along with an updated date & title!

What’s great is that the template that is created is actually basically a tutorial. So you can look through the slides and follow along!

  • The Infinite Moon Reader RStudio Addin mentioned on slide 5 is a great idea since you’ll be able to get real-time visual feedback as you update the code (that is, every time you SAVE the code, the visual feedback will be updated). To use this AddIn, you need to click the highlighted “Addins” drop-down here and underneath the tab for xaringan (which will likely be all the way at the bottom of menu because it is ordered alphabetically):

presentation in rmarkdown

It’s also worth noting that the .Rmd document uses Markdown - a tool I mentioned in a previous post - as I mentioned before, you can see this link for a great introductory guide on how to format text using Markdown, which allows you to format certain pieces of text (e.g., italicize the title of your position, link text to a URL)

As I mentioned at the beginning, xaringan has remark.js render the presentation in your browser. So to be able to use xaringan for your presentations, you should have a basic understanding of remark.js. I’d recommend checking out the link provided in the knitted presentation, along with this page . In the following section, I’ll briefly describe the fundamentals of creating and editing xaringan slides.

Creating and editing slides in xaringan

Creating new slides.

To create a new slide, insert three dashes, like so:

presentation in rmarkdown

Centering slides

Markdown may not be as flexible as you need it to be, which is why there are Markdown extensions included. So for instance, if I want to center align my entire slide - I would use the class property as follows:

Background images

Relatedly, I can include background images using a couple of lines of code. Important: background images need to be between the three dashes indicating you are starting a new slide and the name of your slide if you have one (which is indicated using a hashtag, so “Hello world” is the name for the slide below) for the image to be displayed. So for instance, if there is an image at a publicly accessible link, you can use url(insert URL for image) :

If you have an image on your computer that you want to include in the presentation, you’ll need to store the image(s) in the same folder as the .Rmd file for your slides or as a subfolder of the folder as your slides file (apparently for security reasons, as suggested here ). For instance, if I want to include a file of a picture called “widen-gap.jpg” that is stored on my computer, I’d need to store it in the same location as my .Rmd slides file. Then, if I want to populate the image when I knit the presentation and I put the image in the same folder as the .Rmd file, I would call:

The “libs” directory is the default lib_dir option in the YAML header as suggested at the end of this issue page , so I would recommend putting the image somewhere in this folder if you don’t want it in the main directory with your slides .Rmd file. Let’s say you created a subfolder called “img” within the “libs” directory automatically included with xaringan holding the .Rmd file. You would call:

Incremental slides

To make bullets or images appear incrementally, kind of like slide animations, use the template property. To be able to use the template property, you need to create a name for the slide that can later be referenced. So for instance, you can created the first slide as follows:

Then, the slide with the second bullet can be created as follows:

So when you go to knit the final document, the compiled slide with bullet 2 will contain bullet 1 as well.

There is actually a shortcut to creating these templates, instead of having to create names & referencing the previous slide based on its name, you can use two dashes between slides to indicate the you want the latter slide to use the former slide as a template, so using the example above:

More details on creating incremental slides here

Default layouts

There’s an option to create a slide that can set the default layout throughout all of your slides. To me, it seems this would be especially useful if you need to have a company’s logo on all of your slides throughout the presentation. To create this default layout, you can set the layout property to true on the slide you want to be used as the default. So for instance, if I wanted the image from the xaringan slides to be on all of my slides, I would write the following at the beginning of the presentation (or wherever you want the logo to start showing up, since the layout will only be applied to slides presented after the layout is set):

Changing theme

If you want to change things like the font that are pre-set, there are a couple of options:

  • you can edit the CSS (the difficult way, unless you, unlike me, have previous experience with CSS)
  • you can use themes that R users have created. To explore some theme options, run:

Let’s say I want to change the theme to rladies .

I can edit the css argument of the YAML header as follows to set the theme as rladies , along with the associated font:

Hiding slides

Finally, if you need to hide a slide from the presentation but don’t want to delete all of the work you put into it, you can set the exclude property to true at the top of the slide to hide that specific slide, like so:

Adding figures and results

Now that we’ve covered some of what I think are the most relevant features of remark.js to get you up and running with creating and editing slides, we’ll move onto the part that I’m particularly excited about and one of the main reasons I wanted to create presentations in R: seamless integration of code with the rest of the presentation.

Let’s say I want to include the results of a logistic regression model. To present these results, you use the same basic structure you would use in a normal RMarkdown document to include code in the text-based parts. That is, you include the code you want to run within two backtick marks after you indicate the language you want to use (e.g., r ). So for example, in one of my presentations, I included the following code in the .Rmd document:

which is knitted in the presentation as follows:

presentation in rmarkdown

There are two options for including plots of your data in a Xaringan presentation:

  • The first option is: You can save the plot as a file in the folder or subfolder associated with the .Rmd slides file and then call the image in using the include_graphics() method described above:
  • The second option is: You can just import the data and run the code within the presentation itself when it knits! Just make sure to store the data file that will be used in the same folder/subfolder as the .Rmd slides file. For example, if I had the data file in a subfolder of the libs subdirectory associated with my slide .Rmd file:

You can either show the code you used to create the plots, OR you can hide the code using {r, echo = F} (which is most likely what you will be using unless everyone you are presenting to knows R and wants to double-check your work…). If you want code-hiding to be your default option across all slides, you can insert the code I’ve been using at the top of nearly all of my RMarkdown documents that I plan to present to an audience:

One final note about figures: it took me a while to adjust the figure size (i.e., to make sure the figure didn’t look too large or small). The settings for the figure size that seemed to work the best (at least for me) were: fig.width=10, fig.height=5, dpi=300 . Just enter that into the header of the code chunk, and of course feel free to adjust as needed.

You can also show tables of your data or models! 😄 Usually, the kable or DT package will work beautifully. One of the useful benefits of integrating your code and presentation is that you can interact with the data live! For instance, let’s say someone asks you what the minimum value of a certain variable is. If you’ve added a table of the dataset using the DT package for instance, you can actually click the sort button on the table in the presentation and answer the question that way.

Presenting and sharing slides

Slide transitions.

You can transition from slide to slide like pretty much any presentation. There are also a number of awesome keyboard shortcuts that I highly recommend checking out here

Presenter notes

I hadn’t even thought of this before, but there’s a presenter mode! Which I’m now realizing is incredibly important for most of my presentations, since I almost always have notes. To create notes for yourself, insert three question marks in a row:

presentation in rmarkdown

Once you have the final version of your presentation open in your browser, you want to make sure that your audience doesn’t see your notes - so the way to have them only see the presentation is to open a cloned version of the presentation in a new window which allows you to change slides both in the version with the presenter view and the presentation view with slide notes simultaneously. To create this clone, press “c” and a new window should appear. Press the left and right arrow on your keyboard and you’ll see that both windows change slides at the same time! Super cool. Make sure that when you are presenting your slide using screen sharing, share the new window that popped up when you pressed “c” and not the original tab with your presentation, since that is where your presentation notes will be. Now that you are sharing your presentation, you can simply press “p” on your keyboard while in the original tab (not the new window that you recently opened) to open presenter mode (and to close it, just press “p” again).

A quick note about presenter notes: if you do not have more than one display, I would double-check that you are able to share your screen without your audience seeing your notes. I know there are certain platforms like Google slides that lets you use your notes while you are only sharing one screen, but it may be difficult to present your slides without your audience seeing your notes with one screen using Xaringan from what I can tell.

Converting to different formats

It looks like there is an option to convert your slides to a .pptx and other formats in case you need to send a specific document type over before your big presentation for whatever reason. See this package for instructions on how to create different document types (e.g., png, pdf, pptx, etc.) from your .Rmd file. If your slides are relatively simple (e.g., they don’t include interactive graphics), you should be able to convert to many output types without a hitch. However, if you are including interactive graphics or other advanced features (e.g., panels from the xaringanExtra package ), you should set complex_slides = TRUE when you call one of the build_*() functions. Although I will admit, when I tested this out, it did not seem to completely capture what the original .html file was doing with the cooler features, so I personally would try to avoid having to convert to .pptx unless absolutely necessary.

If you want to use your slides offline, you can download a copy of remark.js beforehand, since the default option in the xaringan package is to use an online version of the presentation. See instructions on how to accomplish this here .

Issues that popped up

Presenter notes don’t display at the correct time if you place the notes right before the next slide while using incremental slides. Here’s a brief description of this issue: https://github.com/yihui/xaringan/issues/55 . My workaround is to place all of my presenter notes at the top of a slide that is incremental and write “(CLICK)” in the notes when I want to click. There might be a more elegant way around this issue though, so I’d recommend exploring Stack Overflow for other recommendations!

Occasionally incremental slides do not work as expected. For instance, I inserted the two little dash lines when I wanted to add a new bullet to a slide, but it shows both bullets at the same time. After some exploration, I realized that there was trailing white space after the dashed lines! remark.js is extremely sensitive to this, so make sure that you delete all spaces after the two dashed lines to be able to create your incremental slides. This problem also popped up with presenter notes, make sure not to have white space after question marks or the notes will be rendered as regular text. One option to completely avoid this in the future is to go to the top of the RStudio window, click “Tools” -> “Global Options” -> “Code” -> “Saving” -> “Strip trailing horizontal whitespace when saving”

Resources to explore xaringan further

  • https://spcanelon.github.io/xaringan-basics-and-beyond/slides/day-01-basics.html?panelset4=remark.js2&panelset5=nhsrtheme2&panelset6=moon-reader2&panelset7=markdown2#1
  • https://www.verouden.net/slides/presentation-xaringan/#1
  • https://alison.rbind.io/talk/2019-rsc-xaringan/
  • https://www.kirenz.com/slides/xaringan-demo-slides.html#1

Keana Richards

Keana Richards

Doctoral researcher.

Studying psychology and statistics at the University of Pennsylvania.

  • How to make your resume/CV in R
  • How to plot grouped data in R using ggplot2
  • Using Regular Expressions in R to clean data faster

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. This will open a draft document showing some of the features you can use. Knit it, then start to edit it. Everything you have learnt above about formatting R markdown documents, code chunks, figures and tables for documents applies to presentations.

New slides in xaringan are made with three minus signs. There must not be anything else on that line (not even a space) or it will draw a horizontal line instead.

BioST@TS homepage

rmarkdown Dynamic Documents for R

  • Package overview
  • Learn R Markdown
  • Lua filters in R Markdown
  • all_output_formats: Determine all output formats for an R Markdown document
  • available_templates: List available R Markdown template in a package
  • beamer_presentation: Convert to a Beamer presentation
  • compile_notebook: Compiling R scripts to a notebook
  • context_document: Convert to a ConTeXt document
  • convert_ipynb: Convert a Jupyter/IPython notebook to an R Markdown document
  • default_output_format: Determine the default output format for an R Markdown...
  • draft: Create a new document based on a template
  • find_external_resources: Find External Resource References
  • find_pandoc: Find the 'pandoc' executable
  • github_document: Convert to GitHub Flavored Markdown
  • html-dependencies: Provide common HTML dependencies for R Markdown formats
  • html_document: Convert to an HTML document
  • html_document_base: Base output format for HTML-based output formats
  • html_fragment: Convert to an HTML fragment.
  • html_notebook: Convert to an HTML notebook
  • html_notebook_metadata: Generate R Notebook Metadata
  • html_notebook_output: Generate R Notebook Output
  • html_vignette: Convert to an HTML vignette
  • includes: Include content within output
  • ioslides_presentation: Convert to an ioslides Presentation
  • knit_params_ask: Run a shiny application asking for parameter configuration...
  • knitr_options: Knitr options for an output format
  • knitr_options_html: Knitr options for an HTML output format
  • knitr_options_pdf: Knitr options for a PDF output format
  • latex-dependencies: Provide common LaTeX dependencies
  • latex_dependency: Define a LaTeX package dependency
  • md_document: Convert to a markdown document
  • metadata: The YAML metadata of the current R Markdown document
  • navbar_html: Create a navbar HTML file from a navbar definition
  • odt_document: Convert to an OpenDocument Text (ODT) document
  • output_format: Define an R Markdown output format
  • output_format_dependency: Define and merge an R Markdown's output format dependency
  • output_metadata: The output metadata object
  • paged_table: Create a table in HTML with support for paging rows and...
  • pandoc_args: Functions for generating pandoc command line arguments
  • pandoc_available: Check pandoc availability and version
  • pandoc_citeproc_convert: Convert a bibliograpy file
  • pandoc_convert: Convert a document with pandoc
  • pandoc_exec: Get the path of the pandoc executable
  • pandoc_options: Pandoc options for an output format
  • pandoc_path_arg: Transform path for passing to pandoc
  • pandoc_self_contained_html: Create a self-contained HTML document using pandoc.
  • pandoc_template: Render a pandoc template.
  • parse_html_notebook: Parse an HTML Notebook
  • pdf_document: Convert to a PDF/LaTeX document
  • pkg_file_lua: Get the full paths of Lua filters in an R package
  • powerpoint_presentation: Convert to a PowerPoint presentation
  • publish_site: Publish an R Markdown Website
  • relative_to: Relative path utility function
  • Browse all...

powerpoint_presentation : Convert to a PowerPoint presentation In rmarkdown: Dynamic Documents for R

View source: R/powerpoint_presentation.R

Convert to a PowerPoint presentation

Description.

Format for converting from R Markdown to a PowerPoint presentation. Pandoc v2.0.5 or above is required.

R Markdown output format to pass to render()

Related to powerpoint_presentation in rmarkdown ...

R package documentation, browse r packages, we want your feedback.

presentation in rmarkdown

Add the following code to your website.

REMOVE THIS Copy to clipboard

For more information on customizing the embed code, read Embedding Snippets .

presentations

.

Loading metrics

Open Access

Ten simple rules for teaching an introduction to R

Contributed equally to this work with: Ava M. Hoffman, Carrie Wright

Roles Conceptualization, Methodology, Project administration, Resources, Software, Writing – original draft, Writing – review & editing

* E-mail: [email protected]

Affiliations Biostatistics Program, Fred Hutchinson Cancer Center, Seattle, Washington, United States of America, Department of Biostatistics, Johns Hopkins University, Baltimore, Maryland, United States of America

ORCID logo

  • Ava M. Hoffman, 
  • Carrie Wright

PLOS

Published: May 16, 2024

  • https://doi.org/10.1371/journal.pcbi.1012018
  • Reader Comments

Fig 1

Citation: Hoffman AM, Wright C (2024) Ten simple rules for teaching an introduction to R. PLoS Comput Biol 20(5): e1012018. https://doi.org/10.1371/journal.pcbi.1012018

Editor: Scott Markel, Dassault Systemes BIOVIA, UNITED STATES

Copyright: © 2024 Hoffman, Wright. This is an open access article distributed under the terms of the Creative Commons Attribution License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Funding: Drs. A.M.H. and C.W. are paid for their teaching efforts on a per-course basis as institutional faculty at Johns Hopkins Bloomberg School of Public Health and guest instructors at University of Washington College of Arts and Sciences. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Competing interests: The authors have declared that no competing interests exist.

Introduction

The demand for data science skills across disciplines has led to massive growth of data-related programs in universities, standalone courses, and other learning materials [ 1 ]. While demand is high, program administrators often struggle to find instructors [ 2 ]. Many learners end up teaching themselves and climbing a very steep learning curve [ 3 ]. On the other hand, scientists with deep research backgrounds often end up teaching with little experience or guidance. We believe better resources for busy and/or less experienced instructors are part of the solution to meeting the demand for programming skills education.

The Open Educational Resources (OER) movement has propelled data science forward by improving the quality, depth, and availability of free materials [ 4 ]. This includes textbooks, tutorials, vignettes, datasets, software tools, case studies, and of course, programming courses. Despite ongoing challenges, such as awareness and access to computers, democratizing educational resources makes high-quality content available to a global audience. This in turn nurtures collaboration and innovation. As data science continues to influence all aspects of our lives, we must consider key takeaways for adopting materials across classrooms and contexts.

Here, we provide guidance to instructors tasked with teaching beginner level programming, specifically an introduction to the R language. Our perspective comes from co-teaching over 300 professionals, graduate students, and undergraduate interns at institutions like Johns Hopkins School of Public Health, University of Washington, and Fred Hutchinson Cancer Center. Our learners usually lack a computer science background and often juggle full-time employment and coursework. The 10 rules we present distill our key reflections from our experiences teaching R. We hope these rules will help you plan your course structure, incorporate general guidance and approaches, and understand specific pitfalls learners are likely to encounter.

Rule 1: Make it intensive

Most of us feel the strain of day-to-day distractions like responding to and reading emails, Slack messages, and various other pings. These forms of communication, while (probably) important, can be distracting and get in the way of deep work [ 5 ]. Programming is about problem solving, which can be frustrating or even impossible if you are thinking about the next task on your to-do list. Instead of learning R in small chunks, we suggest a condensed format for introducing R where learners’ distractions are minimized. Intensive courses can lead to better learner experiences and outcomes, such as greater course effectiveness [ 6 ], lower perceived stress [ 7 ], improved focus [ 7 , 8 ], and greater student success rates [ 8 ]. As the instructor, you should also fully commit to being present for learners by minimizing meetings and unrelated correspondence where possible during a condensed course.

Learning a programming language is not unlike learning a spoken language. It requires focus, commitment, and practice [ 3 ]; some degree of immersion can also be helpful [ 9 – 11 ]. For example, our course “Introduction to R for Public Health Researchers” ( Fig 1 ) [ 12 ] takes place during the Johns Hopkins University Summer and Winter Institutes, over 9 days of 3 hour sessions each. Sessions are recorded to help participants review the material and to maximize accessibility. After the 9 interactive days, learners have a week in which to submit assignments and a final project (see Rule 6). Based on our experience and student feedback, we believe our format effectively balances immersion in R with measures that largely prevent learners from feeling overwhelmed.

thumbnail

  • PPT PowerPoint slide
  • PNG larger image
  • TIFF original image

In week 1, an introduction is given followed by topics in reproducibility, data input, basic R, data subsetting, summarizing, and cleaning. Week 2 consists of data manipulating, an introduction to a visualization GUI (for example, Esquisse—[ 13 ]), programmatic visualization, statistics, and functions. Week 3 allows learners to complete projects. Note that week 2 typically includes a free Monday to observe Martin Luther King, Jr. Day or Juneteenth.

https://doi.org/10.1371/journal.pcbi.1012018.g001

Rule 2: Teach as a team

No one instructor has expertise in every aspect of R programming. Consider teaching as a team, where multiple instructors take turns diving into topics. A teaching team provides a broader range of skills, knowledge, and personalities when going over materials. We all explain solutions to problems a bit differently, which can help “unlock” programming principles for a wider array of learners. Team teaching also has other benefits, such as greater professional and social support for instructors [ 14 ].

No matter how down-to-Earth your team is, many learners find programming intimidating [ 15 ]. Learners often have many questions or do not know what questions to ask. Leverage tools like Slack or Zoom chat to boost communication and peer collaboration. These platforms enable learners to ask questions, seek clarifications, and learn from peers’ conversation threads in a way that can feel more familiar [ 16 ]. Asynchronous communication on platforms like Slack can complement the live sessions and accommodate different learning styles. Ensure there are ample opportunities for questions, both directly to your team, and in public forums with peers.

Working as a team of instructors makes it easier to manage these communication channels. For example, while one instructor leads the lecture and demonstrations, another can provide real time assistance via Zoom chat or Slack. This approach creates a supportive learning atmosphere and ensures that learners have access to timely guidance throughout their learning journey. This kind of support is critical for an inclusive and diverse learner cohort [ 1 ]. It also ensures the instructor leading the demonstrations is able to stay on-topic and stick within anticipated time constraints.

Rule 3: Teach reproducibly using dynamic documents

It can be challenging to maintain a current version of R, let alone keep up with the constant updates in the R ecosystem. Thoughtful planning with a version control system, such as Git and GitHub, makes updating easier and minimizes lead time ahead of the class. To ensure consistency of materials across many publishing platforms, we designed an in-house GitHub-based tool called OTTR ( ottrproject.org ) [ 17 ] to automate rendering materials, including our website [ 12 ], from plain text R Markdown documents. We encourage you to use GitHub’s other features, such as issues and projects, to track changes and ideas in real-time. This simplifies the process of identifying and resolving sticking points for learners in the course materials as they emerge, and before you forget.

Similarly, we recommend using R Markdown or Quarto file formats during live demos and labs. Using these tools encourages beginners to follow best practices, including organizing code into sections and annotating code, by default. It might be much faster for you, a seasoned coder, to quickly enter something in the console, but beginners often lack the intuition for what code should be “saved” and what code is disposable. Learners should practice saving all their code in reproducible documents where they can also take notes and record their thoughts throughout the process.

Rule 4: Prioritize intuition over memorization

Programming is much more than just memorizing functions. During an introductory programming course, learners should start to develop an intuition for the language. In other words, they will begin to understand the grammar of how functions, objects, and chunks of code are ordered and oriented. However, learners will often get bogged down in details and feel overwhelmed. It is important to reiterate to learners that a key goal is to practice and gain familiarity and intuition for R programming.

We strongly recommend equipping learners with this expectation from the beginning. Being clear about this goal can help shift their attitude and anticipations about their experience to be more positive and growth-oriented. They are also more likely to grasp crucial skills for their future R programming journey, like interpreting documentation and seeking assistance. In the age of code-ready large language models like ChatGPT, it is more essential to teach how to interpret, test, and debug, rather than recall specific functions.

To encourage intuition, we include summaries of key functions at break points, such as before breaking out into a coding lab or at the end of a module. This helps learners focus on application of key functions and behaviors rather than recall. Summary pages and cheatsheets that match the course content ([ 18 ], see “Cheatsheets” section) can also serve as key reference points throughout the course.

Another strategy is having your class embrace the practical solution of “Googling it.” Teach learners how to search appropriately, reference documentation, and assess code from crowd-sourced forums like StackOverflow with a critical eye [ 19 ]. You can also explain that professionals check documentation regularly, as packages are updated frequently. We believe sharing how you search for answers is part of being an authentic teacher, which can lead to more meaningful and deeper student learning [ 20 ].

Rule 5: Boost live code and lab time

Live coding with an instructor makes it easier for beginners to understand the programming process, code debugging, and good coding practices [ 21 – 23 ]. Although it might be challenging to implement for large class sizes, hands-on experience is vital for learners to integrate new information, make mistakes, and learn from one another. We suggest prioritizing live coding demonstrations and allocating ample lab time for learners to practice [ 24 ]. In student feedback, this is consistently highlighted as our strongest course component.

During live demonstrations, check your ego at the door and embrace errors made in front of the class. This can be a fantastic opportunity to ask the class, “who can spot where I’ve made a mistake?”, “let’s guess what is causing this issue”, or even “let’s consult the documentation for clues.” For team-taught courses, it can be useful to divide the class into smaller groups for lab sessions. We have found that learners have different preferences; some want more guidance during lab, others want to try everything themselves first, while others need more one-on-one attention. Instructors can take on different levels of guidance to match these preferences.

Rule 6: End the course with a project

Like learning to drive a car, real-world practice is arguably the best way to become proficient. R programming should be a practical, goal-oriented skill, with responsible practices in mind [ 25 ]. To reinforce this, you should center the course around a comprehensive project [ 26 ]. Embracing a project-oriented approach enables learners to apply concepts in real-world scenarios, including their own (nonsensitive) data, fostering deeper comprehension, curiosity, and motivation [ 27 ]. This works particularly well for graduate students and professionals who are more likely to have their own data available. You can further encourage creativity and autonomy in project selection to cater to individual interests and goals. Undergraduate students or learners who lack data will benefit from more guidance [ 28 ], such as repositories where they can find publicly available data (e.g., as appear in [ 29 ]). Ultimately, projects should test application of knowledge through a defined rubric, which when refined ahead of time, makes grading less stressful.

Ensure learners have easy access to the many online resources where they can customize their projects and continue their development (e.g., [ 18 ]). Where possible, take the time to meet with members of the class individually and support them in discovering the right next steps. Approach these conversations with an open mind; discussions might include applying for jobs in both academia and industry, what to do with their specific type of data, or how to translate commands from other platforms (such as SAS or Stata) or interfaces (such as Shiny). Remember that you now serve as a data science role model for your learners.

Rule 7: Get (and give) feedback often

Classroom surveys can be an excellent way to understand learners’ backgrounds, build rapport, and make the course more inclusive, especially in an online setting [ 30 – 32 ]. Use a free platform, such as Google Forms, to collect information about learners’ interests. For example, you might ask about their majors/areas of study, why they are taking the class, and their level of previous experience with computers more generally. This information helps ground the course, helping you determine how much time to spend on fundamentals versus more advanced or niche topics. Understanding learners’ general interests can help you choose more relevant data sets and examples.

Ensure learners are able to provide feedback throughout the duration of the course. We use a “pulse check” feedback form which can be taken multiple times throughout the course [ 33 ]. Learners are encouraged to provide feedback daily, though this is not required. We also make the form anonymous by default, with the option to fill in an email address or name if the learner wishes. Feedback forms can reveal how learners are feeling generally (such as on a Likert 1–10 scale), but can also help you understand what went well, what was challenging, how the pace feels, or what they would like to see covered or reviewed in more detail (such as via free text). For example, we received feedback early on in our course that learners were more interested in cleaning character data (i.e., with stringr ) and handling missing data (i.e., with naniar ). In future iterations, we dove into these topics in more detail instead of other topics, like “date” data types. Anonymous forms also provide the opportunity for learners to alert you to more serious issues, such as problems related to the code of conduct.

When providing feedback, strive to cultivate an inclusive and supportive environment to encourage continuous growth and improvement. Instead of simply correcting errors, encourage practice, resourcefulness, and problem-solving skills, as they are essential in the real-world application of R programming. This includes showing learners how they might find the correct answers in documentation or vignettes, search StackOverflow.com , or use AI tools like ChatGPT or Phind to translate a chunk of code. Importantly, if learners locate code elsewhere, they should be able to interpret, at a very general level, what is happening and why. As with any teaching, be very clear about the criteria by which learners will be graded, if applicable (see Rule 6).

Rule 8: Commit to tidyverse or base R

In R, you can help new learners build a strong foundation by committing to either the Tidyverse ecosystem or base R from the outset. Switching between related languages or language “dialects” can erode learner confidence and cause confusion [ 21 , 34 ]. For example, learners often struggle with when to extract a column of a dataset as a vector using dplyr::pull() . Mixing in base $ notation further muddies the waters. A new programmer can accomplish their end goal using either readr::read_csv (Tidyverse) or read.csv() (base R) and does not need to know both when starting out.

The choice of R ecosystem depends both on your experience and comfort level, as well as the goals of your student audience. For example, our audience typically consists of researchers and practitioners in the public health sphere who have no prior R experience. These learners are more interested in data cleaning, analysis, and visualization. The Tidyverse works well for these goals and is valued by instructors for its readability, consistency, and user community [ 34 ]. However, if your learners are more interested in software development, dependency minimization, optimization, or mathematical applications, base R might be more appropriate. Some researchers have found base R easier for learners [ 35 ], while others found no difference [ 36 ].

Rule 9: Start with data wrangling

An introduction to R programming should focus on data wrangling and basic statistics rather than diving into complexities of data types, classes, and functional programming. Most R users are interested in analyses and data transformation; very few users describe themselves as software developers [ 37 ]. The reality is that most R learners will not be writing software, at least not right away. Data wrangling, or the process of cleaning, preparing, transforming, and/or manipulating data, is typically the most time consuming part of data analysis and is a prerequisite for visualization, reporting, and other statistical insights [ 38 ].

Data wrangling is a practical and essential skill in most fields and allows learners to work with interesting, real-world datasets from the start. Once learners gain an intuition for R through data cleaning and manipulation techniques, they will be better prepared to explore more advanced topics. As Rule 8 suggests, how long the instructor spends on data wrangling does depend somewhat on your audience. Learners who will take their R skills back to applied fields will benefit from spending more time with data wrangling. Learners with experience in other programming languages might be more eager to move on to advanced topics more quickly. Get to know your class with surveys (Rule 7) so you can adjust accordingly.

Rule 10: Know the common pitfalls

Explicitly pointing out common mistakes can help learners avoid them without added anxiety. It can also help them focus on actually learning the intended material. We encourage you to include resources specifically addressing common mistakes, introduce common mistakes when starting a new topic, and show common mistakes during demonstrations. Encouraging learners to share and describe mistakes often helps other learners feel more comfortable and confident. These moments also provide an opportunity to discuss why these mistakes happen. Having taught hundreds of learners, we see many pitfalls repeatedly. We have summarized these here and on our course Help page ( Table 1 ) [ 39 ].

thumbnail

https://doi.org/10.1371/journal.pcbi.1012018.t001

Conclusions

Over 5 course sessions and additional workshops, we have co-taught R to hundreds of learners. We have consistently earned overall course and overall instructor ratings in the outstanding range (over 3.6 on a 4-point scale with 70% or greater response rate) for our courses ). Using student feedback, we have earned these scores through continuous improvement and collaborative refinement. We feel that these rules strike the right balance in making R approachable for learners with limited computational experience, while also cultivating skills for rigorous and ethical scientific practices.

Although our experience has inspired us to follow these “rules,” we still face a number of challenges. The learning curve for R is steep, and many learners wish for a gentler on-ramp. However, aside from prescribing self-guided pre-work and offering assurance, we have yet to find a consistently effective way to address the root of this challenge without sacrificing content. Interestingly, learners who dislike the learning curve generally feel the class was very rewarding and that they learned a lot. Ultimately, you will encounter many trade-offs when instructing, and you should consider benefits and drawbacks thoughtfully with respect to your audience.

We encourage you to explore additional resources and references to further enhance your teaching methods. These include not only academic journals, but also teaching materials and lesson plans on platforms like the Data Carpentry and RStudio Education, as well as blogs, data science conferences, and package vignettes. Together, we can contribute to a thriving community and collection of resources, ensuring that learners have access to high-quality programming education.

Much of the advice we give to brand new R programmers applies to teaching R as well. Make mistakes and try new things. Google things and read documentation. Explore new communication approaches, such as via social media. Leverage the community and reach out to colleagues for support. Build off of open-source resources to grow your teaching plan. Tell the story of your R journey, and enjoy passing what you know along to the next wave of R users.

Acknowledgments

We thank J Muschelli and A Jaffe for creating the first iteration of Intro to R at Johns Hopkins. We also thank our community of co-instuctors—M Karas, C McKee, and C Savonen—and teaching assistants—M Breshock, Q Meng, A Newman, P Saravanan, G Schumock, R Sen, and F Wang—for their time and dedication.

  • View Article
  • Google Scholar
  • PubMed/NCBI
  • 12. Introduction to R for Public Health Researchers: Home. Available from: https://jhudatascience.org/intro-to-r/https://jhudatascience.org/intro_to_r/
  • 15. Rohmeyer R, Sanjuan Espejo P, Sun L, Frederick C. A human factors perspective on learning programming languages using a second language acquisition approach. American Society For Engineering Education, Zone II Conference. 2017 Mar;1–7. Available from: https://commons.erau.edu/publication/572/ .
  • 18. Introduction to R for Public Health Researchers: Resources. Available from: https://jhudatascience.org/intro_to_r/resources.html .
  • 22. Raj AGS, Patel JM, Halverson R, Halverson ER. Role of live-coding in learning introductory programming. Proceedings of the 18th Koli Calling International Conference on Computing Education Research. 2018 Nov;1–8. https://doi.org/10.1145/3279720.3279725
  • 26. Hui B. Lessons from teaching HCI for a diverse student population. Proceedings of the 20th Koli Calling International Conference on Computing Education Research. 2020 Nov;1–5. https://doi.org/10.1145/3428029.3428054
  • 28. Kross S, Guo P. Five Pedagogical Principles of a User-Centered Design Course that Prepares Computing Undergraduates for Industry Jobs. Proceedings of the 53rd ACM Technical Symposium on Computer Science Education. 2022 Feb;168–174. https://doi.org/10.1145/3478431.3499341
  • 29. Introduction to R for Public Health Researchers: Project Guidelines. Available from: https://jhudatascience.org/intro_to_r/modules/Project_Guidelines/Project_Guidelines.html .
  • 32. Skiles L. Using Course Surveys to Foster an Inclusive Environment in Online Courses. Arizona State University Teach Online Blog. 2021 Oct 29. Available from: https://teachonline.asu.edu/2021/10/using-course-surveys-to-foster-an-inclusive-environment-in-online-courses/ .
  • 33. Introduction to R for Public Health Researchers: Daily Survey. Available from: https://docs.google.com/document/d/1RejII6WGR2IPfIwlyL33X8lf65MoTs4VY5oz6tkR9pQ/edit?usp=sharing .
  • 37. Howe C, Hill AP. R Community Survey. GitHub. 2020. Available from: https://github.com/rstudio/r-community-survey .
  • 38. Boehmke BC. Data Wrangling with R. Springer International Publishing Switzerland. 2016. Available from: https://link.springer.com/book/10.1007/978-3-319-45599-0 .
  • 39. Introduction to R for Public Health Researchers: Help. Available from: https://jhudatascience.org/intro_to_r/help.html .
  • 40. Introduction to R for Public Health Researchers: Quotes versus backticks. Available from: https://jhudatascience.org/intro_to_r/resources/quotes_vs_backticks.html .
  • 41. Introduction to R for Public Health Researchers: Functions that need pull() first. Available from: https://jhudatascience.org/intro_to_r/resources/functions_for_vectors.html .
  • Python Basics
  • Interview Questions
  • Python Quiz
  • Popular Packages
  • Python Projects
  • Practice Python
  • AI With Python
  • Learn Python3
  • Python Automation
  • Python Web Dev
  • DSA with Python
  • Python OOPs
  • Dictionaries
  • Resize the image in jupyter notebook using markdown
  • Jupyter Notebook Extension in Visual Studio Code
  • Using R programming language in Jupyter Notebook
  • Getting started with Jupyter Notebook | Python
  • Data Visualization in jupyter notebook
  • Install Python package using Jupyter Notebook
  • How to Write and Run Code in Jupyter Notebook
  • Jupyter notebook Tips and Tricks
  • Using Jupyter Notebook in Virtual Environment
  • Understanding Jupyter Notebook Widgets
  • Jupyter notebook VS Python IDLE
  • How to Use ChatGPT to Create Presentations using Slides AI
  • How To Use Jupyter Notebook - An Ultimate Guide
  • How to Change the Theme in Jupyter Notebook
  • How to upload a dataset in Jupyter Notebook?
  • Configure Keyboard Shortcuts in Jupyter Notebook
  • Creating Interactive Slideshows in Jupyter Notebooks
  • Creating and updating PowerPoint Presentations in Python using python - pptx
  • How to Install Jupyter Notebook on Windows?

Create Presentations Using RISE in Jupyter Notebook

RISE is an extension of Jupyter Notebook designed to revolutionize the way you create presentations. By seamlessly integrating with Jupyter Notebook, RISE allows you to transform your static code and data into dynamic, interactive presentations. In this guide, we’ll explore how to install RISE, set up presentation slides, view and present your slides, and delve into the additional features of using the RISE chalkboard for enhanced interactivity.

Installation of RISE

Let’s start with the basics. Installing RISE is the first step towards creating engaging presentations in Jupyter Notebook . To install RISE, follow these simple steps:

Open your terminal, use the following command, and press shift+enter to execute the command:

python -m pip install RISE

Steps to Create Presentations using RISE in Jupyter

Now, let’s move on to setting up your presentation slides. You will find the RISE icon on the top of the Jupyter Notebook page.

1

Setting Up Presentation Slides

Setting up presentation slides involves configuring the slide types and layout for your presentation.

  • Open Jupyter Notebook.
  • Click on the ‘View’ menu at the top of the notebook.
  • Select ‘Cell Toolbar’ from the dropdown menu.
  • Choose ‘Slideshow’ from the options available.

2

Now that you’ve configured your slide types and layout, it’s time to prepare your slides.

Preparing Slides

Creating compelling content for your slides is essential to captivate your audience. Follow these steps to prepare your slides:

  • Create new cells in the notebook for each slide’s content.
  • Assign different slide types to cells based on their purpose, such as Slide, Subslide, Fragment, Skip, or Notes.

Determine the slide types you’ll use:

  • Slide: The content on this slide is self-explanatory. A new slide will start from this cell.
  • Subslide: Type of slide that will appear under the current slide
  • Fragment: If you want to control the flow of information on your slide, divide it into fragments.
  • Skip: skip this cell, it won’t appear on the slide.
  • Notes: This cell works as notes.
  • “ — ”: Inherit behavior from the cell above.

Example: Here’s an example of slide preparation using different slide types:

3

Viewing Presentation

Before presenting to your audience, it’s crucial to preview how your presentation will appear. Here’s how you can do it:

  • Run the notebook by clicking the ‘Run’ button or pressing Shift + Enter.
  • Navigate through the slides using the space bar, arrow keys, or other navigation controls provided by RISE.

Now that you’ve previewed your presentation, Follow these steps to start presenting:

  • Utilize the presentation mode by pressing the appropriate shortcut.
  • Navigate through your slides seamlessly using the space bar, arrow keys, or other navigation controls.

How to Use RISE Chalkboard

Now, let’s explore the additional feature of RISE: the chalkboard. The chalkboard feature allows you to annotate your slides in real time, adding a layer of interactivity to your presentation. Here’s how you can use the RISE chalkboard:

  • Enable the chalkboard mode by clicking on the chalkboard icon in the presentation mode.
  • Use your mouse or touchpad to draw or write on the slides.
  • Erase or clear annotations as needed to maintain clarity.

With the RISE chalkboard, you can engage your audience and make your presentations more interactive and dynamic.

Please Login to comment...

Similar reads.

author

  • Jupyter-notebook

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

R Markdown: The Definitive Guide

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 two sample slides):

Two sample slides in an ioslides presentation.

FIGURE 4.1: Two sample slides in an ioslides presentation.

You can add a subtitle to a slide or section by including text after the pipe ( | ) character. For example:

4.1.1 Display modes

The following single character keyboard shortcuts enable alternate display modes:

'f' : enable fullscreen mode

'w' : toggle widescreen mode

'o' : enable overview mode

'h' : enable code highlight mode

'p' : show presenter notes

Pressing Esc exits all of these modes. See the sections below on Code Highlighting and Presenter Mode for additional detail on those modes.

4.1.2 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 (ab)use this syntax for blockquotes:

4.1.3 Visual appearance

4.1.3.1 presentation size.

You can display the presentation using a wider form factor using the widescreen option. You can specify that smaller text be used with the smaller option. For example:

You can also enable the smaller option on a slide-by-slide basis by adding the .smaller attribute to the slide header:

4.1.3.2 Transition speed

You can customize the speed of slide transitions using transition option. This can be "default" , "slower" , "faster" , or a numeric value with a number of seconds (e.g., 0.5 ) . For example:

4.1.3.3 Build slides

Slides can also have a .build attribute that indicate that their content should be displayed incrementally. For example:

Slide attributes can be combined if you need to specify more than one. For example:

4.1.3.4 Background images

You can specify a background image for a slide using the attribute data-background , and use other attributes including data-background-size , data-background-position , and data-background-repeat to tweak the style of the image. You need to be familiar with CSS to fully understand these four attributes, and they correspond to the CSS properties background , background-size , background-position , and background-repeat , respectively. For example:

4.1.3.5 Custom CSS

You can add your own CSS to an ioslides presentation using the css option:

You can also target specific slides or classes of slides 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 its content using either of the following CSS selectors:

4.1.4 Code highlighting

It is possible to select subsets of code for additional emphasis by adding a special “highlight” comment around the code. For example:

The highlighted region will be displayed with a bold font. When you want to help the audience focus exclusively on the highlighted region press the h key and the rest of the code will fade away.

4.1.5 Adding a logo

You can add a logo to the presentation using the logo option (by default, the logo will be displayed in a 85x85 pixel square). For example:

The logo graphic will be rescaled to 85x85 (if necessary) and added to the title slide. A smaller icon version of the logo will be included in the bottom-left footer of each slide.

The logo on the title page and the rectangular element containing it can be customised with CSS. For example:

These selectors are to be placed in the CSS text file.

Similarly, the logo in the footer of each slide can be resized to any desired size. For example:

This will make the footer logo 150 by 75 pixels in size.

4.1.6 Tables

The ioslides template has an attractive default style for tables so you should not hesitate to add tables for presenting more complex sets of information. Pandoc Markdown supports several syntaxes for defining tables, which are described in the Pandoc Manual.

4.1.7 Advanced layout

You can center content on a slide by adding the .flexbox and .vcenter attributes to the slide title. For example:

You can horizontally center content by enclosing it in a div tag with class centered . For example:

You can do a two-column layout using the columns-2 class. For example:

Note that content will flow across the columns so if you want to have an image on one side and text on the other you should make sure that the image has sufficient height to force the text to the other side of the slide.

4.1.8 Text color

You can color content using base color classes red , blue , green , yellow , and gray (or variations of them, e.g., red2 , red3 , blue2 , blue3 , etc.). For example:

4.1.9 Presenter mode

A separate presenter window can also be opened (ideal for when you are presenting on one screen but have another screen that is private to you). The window stays in sync with the main presentation window and also shows presenter notes and a thumbnail of the next slide. To enable presenter mode add ?presentme=true to the URL of the presentation. For example:

The presenter mode window will open and will always re-open with the presentation until it is disabled with:

To add presenter notes to a slide, you include it within a “notes” div . For example:

4.1.10 Printing and PDF output

You can print an ioslides presentation from within browsers that have good support for print CSS (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 the menu Print to PDF from Google Chrome. Alternatively, you can use the function pagedown::chrome_print() from the pagedown package ( Xie et al. 2022 ) , which calls Chrome to print an Rmd or HTML file to PDF.

4.1.11 Custom templates

You can replace the underlying Pandoc template using the template option:

However, please note that the level of customization that can be achieved is limited compared to the templates of other output formats, because the slides are generated by custom formatting written in Lua, and as such the template used must include the string RENDERED_SLIDES as can be found in the default template file with the path rmarkdown:::rmarkdown_system_file("rmd/ioslides/default.html") .

4.1.12 Other features

Refer to Section 3.1 for the documentation of other features of ioslides presentations, including figure options (Section 3.1.5 ), MathJax equations (Section 3.1.8 ), data frame printing (Section 3.1.6 ), Markdown extensions (Section 3.1.10.4 ), keeping Markdown (Section 3.1.10.1 ), document dependencies (Section 3.1.9 ), header and before/after body inclusions (Section 3.1.10.2 ), Pandoc arguments (Section 3.1.10.5 ), and shared options (Section 3.1.11 ).

IMAGES

  1. 40 Reports with R Markdown

    presentation in rmarkdown

  2. Create PowerPoint Presentations with R and RMarkdown

    presentation in rmarkdown

  3. presentation in r markdown

    presentation in rmarkdown

  4. Create R Markdown reports and presentations even better with these 3

    presentation in rmarkdown

  5. rmarkdown: Make interactive PowerPoint slide presentations in R

    presentation in rmarkdown

  6. How to use R Markdown (part one)

    presentation in rmarkdown

VIDEO

  1. Rmarkdown depuis (Neo)Vim !

  2. R Pasar de RMarkdown a Quarto

  3. Apresentações Automáticas com o R

  4. Jon Harmon

  5. R Markdown: Table of Contents

  6. Les journées 2024 du GdR EcoStat

COMMENTS

  1. Slide Presentations

    Turn your analyses into high quality documents, reports, presentations and dashboards with R Markdown. Use a productive notebook interface to weave together narrative text and code to produce elegantly formatted output. Use multiple languages including R, Python, and SQL. R Markdown supports a reproducible workflow for dozens of static and dynamic output formats including HTML, PDF, MS Word ...

  2. Chapter 4 Presentations

    Chapter 4 Presentations. Chapter 4. Presentations. For documents, the basic units are often sections. For presentations, the basic units are slides. A section in the Markdown source document often indicates a new slide in the presentation formats. In this chapter, we introduce the built-in presentation formats in the rmarkdown package.

  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

    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. R will ask you to install a couple of dependencies if this is your first time working with R Markdown.

  5. Mastering R presentations

    How to start. The first step is to get R and RStudio, and install the package rmarkdown with the code. install.packages("rmarkdown") In the last versions you can directly create presentations going to File -> New File -> R Presentation.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 ...

  6. How To Make A PowerPoint Presentation Using R Markdown

    We assume you have R and RStudio installed. 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.

  7. Enhance Your Storytelling

    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.

  8. 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...

  9. Creating and Styling PPTX Slides with {rmarkdown}

    Emil Hvitfeld presents the process of creating and styling Powerpoint slides with {rmarkdown}. Emil walks through three ways of creating a Powerpoint slide f...

  10. Nathan Stephens

    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 ...

  11. 4.4 PowerPoint presentation

    4.4 PowerPoint presentation. 4.4. PowerPoint presentation. To create a PowerPoint presentation from R Markdown, you specify the powerpoint_presentation output format in the YAML metadata of your document. Please note that this output format is only available in rmarkdown >= v1.9, and requires at least Pandoc v2.0.5.

  12. Convert to a PowerPoint presentation

    Format for converting from R Markdown to a PowerPoint presentation. Pandoc v2.0.5 or above is required. ... Markdown extensions to be added or removed from the default definition of R Markdown. See the rmarkdown_format for additional details. slide_level. The heading level which defines individual slides. By default this is the highest header ...

  13. Making a Presentation in R: Getting started

    A new window should appear, with four possible options for creating the new RMarkdown file: "Document," "Presentation," "Shiny," or "From Template". Click "From Template" and at the bottom of the list you should see "Ninja Presentation". Now, you should have a template slide deck that you can edit right away!

  14. 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. This will open ...

  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. R Markdown PowerPoint Slide Customization

    This brings up the following view: Click on Insert Layout (near left end of ribbon) to create a new slide layout, which will become our edge-to-edge picture layout. Then click on the Insert Placeholder dropdown and select Picture. Then click-drag to add an edge-to-edge picture placeholder in the slide layout we just created.

  17. powerpoint_presentation : Convert to a PowerPoint presentation

    In addition to the named methods you can also pass an arbitrary function to be used for printing data frames. You can disable the df_print behavior entirely by setting the option rmarkdown.df_print to FALSE. See Data frame printing section in bookdown book for examples. Keep the markdown file generated by knitting.

  18. 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):

  19. presentations

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

  20. Marp: Markdown Presentation Ecosystem

    Marpit (independented from Marp) is the framework that transforms Markdown and CSS themes to slide decks composed of HTML/CSS. It is optimized to output only the minimum set of assets required. Find all of the Marp tools, integrations, and examples in the GitHub repository! Marp (also known as the Markdown Presentation Ecosystem) provides an ...

  21. Ten simple rules for teaching an introduction to R

    PPT. PowerPoint slide. PNG. larger image. TIFF. original image. ... to automate rendering materials, including our website , from plain text R Markdown documents. We encourage you to use GitHub's other features, such as issues and projects, to track changes and ideas in real-time. This simplifies the process of identifying and resolving ...

  22. 2.8 Interactive documents

    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 ...

  23. Create Presentations Using RISE in Jupyter Notebook

    Let's start with the basics. Installing RISE is the first step towards creating engaging presentations in Jupyter Notebook. To install RISE, follow these simple steps: Open your terminal, use the following command, and press shift+enter to execute the command: python -m pip install RISE.

  24. Chapter 8 reveal.js 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 ...

  25. 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 ...