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

create presentations using r

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:

create presentations using r

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:

create presentations using r

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:

create presentations using r

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

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.

create presentations using r

Continue to Dashboards

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

create presentations using r

8   Slideshow Presentations

You are reading the free online version of this book. if you’d like to purchase a physical or electronic copy, you can buy it from no starch press , powell’s , barnes and noble or amazon ..

If you need to create a slideshow presentation, like one you might create in PowerPoint, R has you covered. In this chapter, you’ll learn how to produce presentations using xaringan . This package, which uses R Markdown, is the most widely used tool for creating slideshows in R.

You’ll use xaringan to turn the penguin report from Chapter 6 into a slideshow. You’ll learn how to create new slides, selectively reveal content, adjust text and image alignment, and style your presentation with CSS.

Why Use xaringan?

You might have noticed the Presentation option while creating a new R Markdown document in RStudio. This option offers several ways to make slides, such as knitting an R Markdown document to PowerPoint. However, using the xaringan package provides advantages over these options.

For example, because xaringan creates slides as HTML documents, you can post them online versus having to email them or print them out for viewers. You can send someone the presentation simply by sharing a link. Chapter 9 will discuss ways to publish your presentations online.

A second benefit of using xaringan is accessibility. HTML documents are easy to manipulate, giving viewers control over their appearance. For example, people with limited vision can access HTML documents in ways that allow them to view the content, such as by increasing the text size or using screen readers. Making presentations with xaringan lets more people engage with your slides.

How xaringan Works

To get started with xaringan , run install.packages("xaringan") in RStudio to install the package. Next, navigate to File > New File > R Markdown to create a new project. Choose the From Template tab and select the template called Ninja Presentation , then click OK .

You should get an R Markdown document containing some default content. Delete this and add the penguin R report you created in Chapter 6 . Then, change the output format in the YAML to xaringan::moon_reader like so:

The moon_reader output format takes R Markdown documents and knits them as slides. Try clicking Knit to see what this looks like. You should get an HTML file with the same name as the R Markdown document (such as xaringan-example.html ), as shown in Figure  8.1 .

create presentations using r

If you scroll to the next slide with the right arrow key, you should see familiar content. Figure  8.2 shows the second slide, which has the same text as the report from Chapter 6 and a cut-off version of its histogram.

create presentations using r

Although the syntax for making slides with xaringan is nearly identical to that used to make reports with R Markdown, you need to make a few tweaks so that the content can fit on the slides. When you’re working in a document that will be knitted to Word, its length doesn’t matter, because reports can have 1 page or 100 pages. Working with xaringan , however, requires you to consider how much content can fit on a single slide. The cut-off histogram demonstrates what happens if you don’t. You’ll fix it next.

Creating a New Slide

You’ll make this histogram fully visible by putting it in its own slide. To make a new slide, add three dashes ( --- ) where you’d like it to begin. I’ve added them before the histogram code:

When you knit the document again, what was one slide should now be broken into two: an Introduction slide and a Bill Length slide. However, if you look closely, you’ll notice that the bottom of the histogram is still slightly cut off. To correct this, you’ll change its size.

Adjusting the Size of Figures

Adjust the size of the histogram using the code chunk option fig.height :

Doing this fits the histogram fully on the slide and also reveals the text that was hidden below it. Keep in mind that fig.height adjusts only the figure’s output height; sometimes you may need to adjust the output width using fig.width in addition or instead.

Revealing Content Incrementally

When presenting a slideshow, you might want to show only a portion of the content on each slide at a time. Say, for example, that when you’re presenting the first slide, you want to talk a bit about each penguin species. Rather than show all three species when you open this slide, you might prefer to have the names come up one at a time.

You can do this using a feature xaringan calls incremental reveal . Place two dashes (–) between any content you want to display incrementally, like so:

This code lets you show Adelie onscreen first; then Adelie and Gentoo; and then Adelie, Gentoo, and Chinstrap. When presenting your slides, use the right arrow to incrementally reveal the species.

Aligning Content with Content Classes

You’ll also likely want to control how your content is aligned. To do so, you add the content classes .left[] , right[] , and center[] to specify the desired alignment for a piece of content. For example, to center-align the histogram, use .center[] as follows:

This code centers the chart on the slide.

Other built-in options can make two-column layouts. Adding .pull-left[] and .pull-right[] will make two equally spaced columns. Use the following code to display the histogram on the left side of the slide and the accompanying text on the right:

Figure  8.3 shows the result.

create presentations using r

To make a narrow left column and wide right column, use the content classes .left-column[] and .right-column[]. Figure  8.4 shows what the slide looks like with the text on the left and the histogram on the right.

create presentations using r

In addition to aligning particular pieces of content on slides, you can also horizontally align the entire content using the left , right , and center classes. To do so, specify the class right after the three dashes that indicate a new slide, but before any content:

This code produces a horizontally centered slide. To adjust the vertical position, you can use the classes top , middle , and bottom .

Adding Background Images to Slides

Using the same syntax you just used to center the entire slide, you can also add a background image. Create a new slide, use the classes center and middle to horizontally and vertically align the content, and add a background image by specifying the path to the image within the parentheses of url() :

To run this code, you’ll need a file called penguins.jpg in your project (you can download it at https://data.rfortherestofus.com/penguins.jpg ). Knitting the document should produce a slide that uses this image as a background with the text Penguins in front of it, as shown in Figure  8.5 .

create presentations using r

Now you’ll add custom CSS to further improve this slide.

Applying CSS to Slides

One issue with the slide you just made is that the word Penguins is hard to read. It would be better if you could make the text bigger and a different color. To do this, you’ll need to use Cascading Style Sheets (CSS) , the language used to style HTML documents. If you’re thinking, I’m reading this book to learn R, not CSS , don’t worry: you’ll need only a bit of CSS to make tweaks to your slides. To apply them, you can write your own custom code, use a CSS theme, or combine the two approaches using the xaringanthemer package.

To add custom CSS, create a new code chunk and place css between the curly brackets:

This code chunk tells R Markdown to make the second-level header ( h2 ) 150 pixels large and white. Adding .remark-slide-content before the header targets specific elements in the presentation. The term remark comes from remark.js , a JavaScript library for making presentations that xaringan uses under the hood.

To change the font in addition to the text’s size and color, add this CSS:

The first new line makes a font called Inter available to the slides, because some people might not have the font installed on their computers. Next, this code applies Inter to the header and makes it bold. You can see the slide with bold Inter font in Figure  8.6 .

create presentations using r

Because xaringan slides are built as HTML documents, you can customize them with CSS however you’d like. The sky’s the limit!

You may not care to know the ins and outs of CSS. Fortunately, you can customize your slides in two ways without writing any CSS yourself. The first way is to apply xaringan themes created by other R users. Run this code to get a list of all available themes:

The output should look something like this:

Some CSS files change fonts only, while others change general elements, such as text size, colors, and whether slide numbers are displayed. Using prebuilt themes usually requires you to use both a general theme and a fonts theme, as follows:

This code tells xaringan to use the default CSS, as well as customizations made in the metropolis and metropolis-fonts CSS themes. These come bundled with xaringan , so you don’t need to install any additional packages to access them. Figure  8.7 shows how the theme changes the look and feel of the slides.

create presentations using r

If writing custom CSS is the totally flexible but more challenging option for tweaking your xaringan slides, then using a custom theme is simpler but a lot less flexible. Custom themes allow you to easily use others’ prebuilt CSS but not to tweak it further.

The xaringanthemer Package

A nice middle ground between writing custom CSS and applying someone else’s theme is to use the xaringanthemer package by Garrick Aden-Buie. This package includes several built-in themes but also allows you to easily create your own custom theme. After installing the package, adjust the css line in your YAML to use the xaringan-themer.css file like so:

Now you can customize your slides by using the style_xaringan() function. This function has over 60 arguments, enabling you to tweak nearly any part of your xaringan slides. To replicate the custom CSS you wrote earlier in this chapter using xaringanthemer , you’ll use just a few of the arguments:

This code sets the header size to 150 pixels and makes all the headers use the bold, white Inter font.

One particularly nice thing about the xaringanthemer package is that you can use any font available on Google Fonts by simply adding its name to header_font_family or another argument that sets font families ( text_font_family and code_font_family are the other two, for styling body text and code, respectively). This means you won’t have to include the line that makes the Inter font available.

In this chapter, you learned how to create presentations using the xaringan package. You saw how to incrementally reveal content on slides, create multi-column layouts, and add background images to slides. You also changed your slides’ appearance by applying custom themes, writing your own CSS, and using the xaringanthemer package.

With xaringan , you can create any type of presentation you want and then customize it to match your desired look and feel. Creating presentations with xaringan also allows you to share your HTML slides easily and enables greater accessibility.

Additional Resources

Garrick Aden-Buie, Silvia Canelón, and Shannon Pileggi, “Professional, Polished, Presentable: Making Great Slides with xaringan,” workshop materials, n.d., https://presentable-user2021.netlify.app .

Silvia Canelón, “Sharing Your Work with xaringan: An Introduction to xaringan for Presentations: The Basics and Beyond,” workshop for the NHS-R Community 2020 Virtual Conference, November 2, 2020, https://spcanelon.github.io/xaringan-basics-and-beyond/index.html .

Alison Hill, “Meet xaringan: Making Slides in R Markdown,” slideshow presentation, January 16, 2019, https://arm.rbind.io/slides/xaringan.html .

Yihui Xie, J. J. Allaire, and Garrett Grolemund, “xaringan Presentations,” in R Markdown: The Definitive Guide (Boca Raton, FL: CRC Press, 2019), https://bookdown.org/yihui/rmarkdown/ .

Creating presentations

Bernhard bieri.

{iheiddown} not only allows its users to create scholarly documents but also provides them with a simple way to create great presentations to share the contents of their research effectively. This article will help you get started from the ground up and help you create your very own first presentation.

Installation

The presentation theme is based on Yihui Xie’s excellent {xaringan} package. Hence the first thing to do is to install the necessary components as well as {iheiddown} itself. Note that we can also install the latest version of the package from GitHub directly by using remotes::install_github("jhollway/iheiddown") .

Before we go any further, we should introduce {xaringan} a bit more since you’ll be working with when creating presentations with the {iheiddown} theme. The first thing to know is that there are many ways to create presentations in (R-)Markdown and that there is not one solution that fulfills all needs. However, after careful consideration (and reading this blog post ) we settled on {xaringan} to develop our presentation template for.

If you want to know more about {xaringan} and other presentation packages for R, check out this excellent book .

Create your first presentation

Creating your first presentation is easy! Let’s look at how it is done. Before we begin, we have to create a new R project by clicking on the file tab in the top of the RStudio window and following the instructions of the prompt that appears. Now that we have created an R project for our presentation, we can open a new R-Markdown file. To do this click on the “plus file” logo in the top left corner and then on “R-Markdown”.

Step 1: Open a project

After you have done this, a little pop-up helper will appear. The first thing we will do is to select the {iheiddown} template for our presentation. To do so, click on the “From Template” option on the left and select the “Presentation {iheiddown}” template. Now give your presentation a name and click on “OK”.

Step 2: Select a template

Congrats! You just created your first presentation!

Hold on, this doesn’t look anything like slides!? To see your slides, you have to “knit” the code by clicking on the little “knit” button on the presentation.Rmd file. This will run all the code chunks and convert the markdown code to an HTML presentation that you will be able to share with your audience.

Take a moment to flick through the slides to get acquainted with the {R-markdown} syntax and to get a feel of the possibilities of {xaringan} and the {iheiddown} theme. These slides are as much a tutorial as this vignette!

Edit your presentation

This section will focus on giving you an overview of what a {xaringan} presentation is comprised of and give you a few tips and tricks to edit your presentations.

Your first edit

As you may have noticed by now, {xaringan} presentations are not quite like more traditional WYSIWYG (what you see is what you get) presentation tools like PowerPoint. In short, you write in the R-markdown file, define style classes in the CSS files and create macros in the JavaScript file. This is all a bit confusing isn’t it? Thankfully, there is a way to vizualise your edits easily in real time!

{xaringan} includes a handy function called inf_mr() which will work in concert with the {servr} package to render your sites locally and update them as soon as you save your markdown document. We simply wrapped these functions inside the more convenient {iheiddown} versions: preview_realtime() and preview_stop() . This makes it a lot easier to edit your slides!

The different elements of a {xaringan} presentation

{xaringan} presentations are comprised of three main components:

  • The main .Rmd file for raw content
  • The CSS file for style and layout options
  • The macros.js file for handy functions

The main .Rmd file will be the core of your presentation, since it is where you will write the text, run R code chunks, and display gifs to entertain your audience.

The CSS file contains all the styling options that will be used to display the the content of the .Rmd file in a nice manner. This file contains the definitions of all the classes we use in the presentation.

Finally, the macros.js file specifies small functions used for specific cases. An example of a macro would be the inclusion of Emily Riederer’s xaringan_columns macros .

Note that editing the CSS and the macros files is not recommended for beginner users as the point of having a theme is to avoid having to fiddle with these files. Advanced users who wish to contribute a feature should open an issue on Github to suggest the additional features.

Tips and tricks for editing your presentations

The following sections cover additional tips and tricks that are not mentionned in the slides. You’ll discover how to animate your slides and how to include a bibliography.

Slide transitions

For ease of use, we have included the {animate.style} library of CSS animations. This allows us to easily animate our slides with the addition of the CSS class animate__animated and the desired animation e.g.  animate__slideInRight on the desired slide.

For a full list of the available animations and further options, check out animate.style .

Adding IHEID logos

We implemented an easy way of including logos from the institute in the top right corner of your presentation. Simply add the with-logo CSS class along the specific logo’s class at the top of a given slide! Here is a list of the logos currently available in the package.

If you think of an IHEID related logo that you would like to add to this collection, feel free to raise an issue and link to the logo resource.

Citations and Bibliography

We all stand on the shoulders of giants when we are conducting research. This is why we have implemented an easy way of generating citations and adding a bibliography to your presentation. Note that this method uses the package {RefManageR} that you will need to install.

The first step to adding a bibliography is to define its options in a code chunk at the very top of your presentation.Rmd file.

The second step is to cite the papers you want to cite inline with Citet() , Citep() , AutoCite() or NoCite() . Here is an example: Citet(myBib, "Entry_Name") . Note that every element that you wish to put in the bibliography at the end must be cited. Hence, if you only want a bibliographical element to appear in the bibliography but not as a citation on one of your slides, use the NoCite() function.

The third and final step is to print the full bibliography in the last slides of your presentation.

Finally, note that you can specify the number of references you want to print on each slide to avoid overfilling them.

For more in depth information about the integration of bibliographic information into your presentations, please visit this wiki .

After creating your presentation, it is time to share it with the world! To do so, simply open the HTML file that was created in your project folder after you knitted it.

{xaringan} provides you with nifty shortcuts to toggle presenter mode (p) or duplicate the slides (c) to present them on a second screen. Clicking “h” will pull up the entire list of shortcuts. Present away!

Printing the slides

There are two main ways to print slides.

  • Works best in the Google Chrome browser
  • Use pagedown::chrome_print() when viewing your Rmarkdown file
  • Use xaringan_to_pdf() an extended printing function that works especially well for complex slide decks. You can find this function in this great blog article by Garrick Aden Buie.

Additional resources

A non-exhaustive list of additional readings and extensions.

  • {Xaringan} documentation
  • Markdown cheatsheet
  • R Markdown: The Definitive Guide
  • Garrick Aden-Buie’s website
  • A collection of neat extensions to make your presentation even prettier/ more functional
  • {flipbookr} aims to remove some of the confusion that might arise when showcasing large chunks of code by taking a step by step approach.

create presentations using r

Make PowerPoint Presentations with R Markdown

create presentations using r

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

R-bloggers

R news and tutorials contributed by hundreds of R bloggers

Programmatically create interactive powerpoint slides with r.

Posted on October 12, 2015 by David Smith in R bloggers | 0 Comments

[social4i size="small" align="align-left"] --> [This article was first published on Revolutions , 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.

Powerpoint is a powerful application for creating presentations, and allows you to include all sorts of text, pictures, animations and interactivity to create a compelling story. Most of the time you'll use the Powerpoint application to create slides, but if you want to include data and/or charts in your slides, in the interests of reproducibility you may want to automate the slide creation process. By using the R language with the Powerpoint API, you can recreate your slides in an instant whenever your data changes.

Asif Salam has created a nice tutorial showing how to use the RDCOMClient package to do exactly that. In the tutorial, Asif goes through the steps of creating the interactive visualization of Clint Eastwood's box office earnings shown below (and which you can also download as a PPT file ):

The tutorial is in three parts:

  • The basics : using the Powerpoint API to create slides and add content (with some use of VBA for animations).
  • Getting data : scraping data from IMDB on Clint Eastwood films and earnings. This part isn't specific to Powerpoint, and of course you can use any data you like in a presentation.
  • Creating a slide : adding elements to a slide using R objects and functions, and creating the animation.

The complete R code and data behind this animated slide is available on GitHub , and will serve as a useful starting point for your own automated slide generation.

By the way, if your needs are simpler and you just want to create static Powerpoint slides from R (with text, data, and graphics), take a look at Slidify . With Slidify, you can generate Powerpoint slides from R using just a Markdown document.

Asif Salam:  Create amazing PowerPoint slides using R – The basics

To leave a comment for the author, please follow the link and comment on their blog: Revolutions . 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.)

Create and format PowerPoint documents from R software

  • Printable version

Reason I : Many collaborators works with Microsoft office tools

  • Reason II : keeping beautiful R graphs beautiful for publications

But wasn’t this problem solved already?

Install and load the reporters package, slide layout, generate a simple powerpoint document from r software, text properties : font, color and size, change the appearance of a “piece of text” (pot), add plots and images, add a table, add ordered and unordered lists, download a template file, slide layouts available in the template file, create a powerpoint document from the template file, why is it important to be able to generate a powerpoint report from r .

There are at least, two reasons for this, as described in the next sections.

About 1 billion people worldwide use Microsoft Office (1 in 7 people on the planet; source: Microsoft ).

Furthermore, many collaborators still working with MS Office software (Word, PowerPoint, Excel) for :

  • editing their text and tracking changes
  • copy-pasting texts, images and tables from multiple sources
  • saving and analyzing their data

In this context, a report generated as a PDF or HTMl files is less useful with some collaborators.

Reason II : keeping beautiful R graphs beautifull for publications

R plots can be customized to be as beautiful as your imagination can make them. Unfortunately, preserving this beauty is not always an easy task when you want to publish these graphs or show them in a professional presentations.

Yes, this problem can be solved using knitr/rmarkdown/Latex/Beamer/Slidify. However, it would be very difficult to remake the whole presentation in a different format. Furthermore, many journals don’t accept Latex documents.

The answer of this question is yes and no. There have been several attempts to solve this problem, but many of them are not easy to use.

One of the previous solutions is R2PPT package. Unfortunately R2PPT is available for Windows OS only and it depends on rcom or RDCOMClient for generating Microsoft PowerPoint presentations.

The goal of this R tutorial is to show you how to easily and quickly, format and export R outputs (including data tables, plots, paragraphs of text and R scripts) from R statistical software to a Microsoft PowerPoint document ( .pptx file format) using ReporteRs package.

ReporteRs is a Java-based solution, so it works on Windows, Mac and Linux.

Use the R code below :

Note that ReporteRs relies on Java (>= 1.6) ; make sure you have an installed JRE

The version of Java installed on your computer, can be checked as follow :

Create a simple PowerPoint document

Four simple steps are required :

  • Use the pptx() function to create a PowerPoint object.
  • Use the addSlide() function to add a slide into the PowerPoint document.
  • addTitle : Add a title
  • addParagraph : Add paragraphs of text
  • addFlexTable : Add a table
  • addPlot : Add a plot generated in R
  • addImage : Add external images
  • addRScript : Highlight and add R code
  • addDate : Add a date
  • addPageNumber : Add a page number
  • AddFooter : Add a footer
  • Write the document into a .pptx file using writeDoc() function

Before showing you an example of how to create and format PowerPoint from R Software, let’s first discuss about slide layout . This is very important to understand the examples provided in this tutorial.

When creating a new slide, you should specify the layout of the slide. The available layouts in the “MS Office PowerPoint” (default template, on my computer) are illustrated in the figure below :

addSlide() function can be used to add a new slide into a PowerPoint document from R software . A simplified format of the function is :

  • doc : a pptx object where slide has to be added
  • slide.layout : the layout to use for the slide.

Among the possible values for the argument slide.layout , there are : “Title Slide”, “Title and Content”, “Two Content”, “Section Header”, “Content with Caption”, “Title Only”, “Comparison”.

However, you should use only the available slide layouts in your computer.

To view the slide layouts available in your computer, use the R code below :

These layouts are illustrated below :

Note that, the selected layout determines the contents you can add into the slide (See the figure above).

  • and one content which can be texts, plots, images, tables or R code
  • and two contents : For example, you can add a table in the left panel and a paragraph of texts in the right panel.
  • Example 3 - If you choose ‘Comparison’ , you can add a title and four contents (plots, tables, paragraphs, images)

Whatever the slide layout chosen, you can use the functions addDate() , addFooter() and addPageNumber() to add date, footer and slide number, respectively.

The R code below creates a PowerPoint document with a title slide, plots, tables, and an R script :

The PowerPoint document created by the R code above is available here : R software and ReporteRs package - Example of creating a PowerPoint document

Note that, you can use addPageNumber() function without specifying the value of the slide number, as follow :

In this case slide number is added using the default setting (e.g : 1 for slide1, 2 for slide 2).

If you want to customize the numbering, use the function as follow :

Format the text of a PowerPoint document

As illustrated in the figure below, text properties include :

  • Font : family (e.g : “Arial”), size (e.g : 11), style (e.g : “italic”)
  • Underlined text
  • Color (e.g : “blue”)
  • Vertical align (superscript, subscript)

The default font size and font family of the PowerPoint can be modified as follow :

The function pot() [Pieces Of Text] is used to modify the appearance of a text. It can be used also to create a hyperlink . The format is :

  • value : the text to be formatted
  • format : the properties to use for formatting the text

The allowed values for the argument format are the following functions :

  • textProperties() : the text formatting properties
  • textBold() , textItalic() , textBoldItalic() and textNormal() which are shortcuts for bold , italic , bold-italic and normal text, respectively.

These functions can take the arguments below :

  • color : font color; e.g : color=“#000000” or color = “black”.
  • font.size : a integer indicating the font size .
  • font.weight : the font weight . Possible values are “normal” or “bold”.
  • font.style : the font style . Possible values are “normal” or “italic”.
  • underlined : a logical value specifying if the text should be underlined .
  • font.family : the font family ; e.g : “Arial”.
  • vertical.align : a character indicating font vertical alignments . Expected values are “baseline”" or “subscript” or “superscript”. Default value is baseline .
  • shading.color : background color of the text (e.g “#000000” or “black”)

The R code below creates a PowerPoint document containing a formatted text and a hyperlink :

The functions addPlot() and addImage() can be used for adding a plot or an external image to the document. addPlot() works with all R plots (base graphics, lattice, ggplot2 and grid).

These two functions can be used as follow :

The R code below creates a PowerPoint document containing a histogram and an image (downloaded from R website) :

The PowerPoint document created by the R code above is available here : R software and ReporteRs package - PowerPoint document containing plots and images

Note that, addPlot() function can take other arguments such as pointsize to change the size of plotted texts (default value is 12; in pixels)

  • For addImage() function, the allowed file formats are PNG, WMF, JPEG and GIF images..

addFlexTable() function is used to format and add a table into the PowerPoint.

It can be used as follow :

  • STEP 1 : Create a table using FlexTable() or vanilla.table() function. These two functions generate a ‘flexible’ table which can be easily formatted before adding into the slide.
  • STEP 2 : Add the create table into the document using addFlexTable() function as follow :

setZebraStyle() function can be used to color odd and even rows differently; for example, odd rows in gray color and even rows in white color.

The example below creates a PowerPoint document with 3 slides containing a simple table (slide 1), vanilla table (slide 2) and a zebra striped table (slide 3) :

The PowerPoint document created by the R code above is available here : R software and ReporteRs package - PowerPoint document containing tables

Lists can be added using addParagraph() function as follow :

  • value : a set of items to be added as a list
  • list.style : possible values are ‘unordered’ and ‘ordered’
  • level : a numeric value indicating the level of the item to be added in the list

The example below generates a one-slide PowerPoint document containing an ordered and unordered lists :

Create a PowerPoint document from a template file

This approach is useful in many situations :

  • If you work in a corporate environment and you want to generate a PowerPoint document based on a template with specific fonts, color, logos, etc.
  • If you want to modify and insert new contents into an existing PowerPoint document.
  • If you want to use text formatting styles and slide layouts from a given template file.

Note that, if you use a template file to create a PowerPoint document, slide layouts are those available in the template.

A template file can be specified to the pptx() function as follow :

In the next section We’ll :

  • download a PowerPoint template file from STHDA website
  • Check the available slide layouts in the template file
  • Create a PowerPoint document based on the template

You can use one of the layout below when adding a new slide into the PowerPoint :

Note that, the template file contains already one empty slide which can be removed manually.

The PowerPoint document created by the R code above is available here : R software and ReporteRs package - PowerPoint document from template

This analysis has been performed using R (ver. 3.1.0).

You can read more about ReporteRs and download the source code at the following link :

GitHub (David Gohel): ReporteRs

Recommended for You!

Recommended for you.

This section contains best data science and self-development resources to help you on your path.

Coursera - Online Courses and Specialization

Data science.

  • Course: Machine Learning: Master the Fundamentals by Standford
  • Specialization: Data Science by Johns Hopkins University
  • Specialization: Python for Everybody by University of Michigan
  • Courses: Build Skills for a Top Job in any Industry by Coursera
  • Specialization: Master Machine Learning Fundamentals by University of Washington
  • Specialization: Statistics with R by Duke University
  • Specialization: Software Development in R by Johns Hopkins University
  • Specialization: Genomic Data Science by Johns Hopkins University

Popular Courses Launched in 2020

  • Google IT Automation with Python by Google
  • AI for Medicine by deeplearning.ai
  • Epidemiology in Public Health Practice by Johns Hopkins University
  • AWS Fundamentals by Amazon Web Services

Trending Courses

  • The Science of Well-Being by Yale University
  • Google IT Support Professional by Google
  • Python for Everybody by University of Michigan
  • IBM Data Science Professional Certificate by IBM
  • Business Foundations by University of Pennsylvania
  • Introduction to Psychology by Yale University
  • Excel Skills for Business by Macquarie University
  • Psychological First Aid by Johns Hopkins University
  • Graphic Design by Cal Arts

Books - Data Science

  • Practical Guide to Cluster Analysis in R by A. Kassambara (Datanovia)
  • Practical Guide To Principal Component Methods in R by A. Kassambara (Datanovia)
  • Machine Learning Essentials: Practical Guide in R by A. Kassambara (Datanovia)
  • R Graphics Essentials for Great Data Visualization by A. Kassambara (Datanovia)
  • GGPlot2 Essentials for Great Data Visualization in R by A. Kassambara (Datanovia)
  • Network Analysis and Visualization in R by A. Kassambara (Datanovia)
  • Practical Statistics in R for Comparing Groups: Numerical Variables by A. Kassambara (Datanovia)
  • Inter-Rater Reliability Essentials: Practical Guide in R by A. Kassambara (Datanovia)
  • R for Data Science: Import, Tidy, Transform, Visualize, and Model Data by Hadley Wickham & Garrett Grolemund
  • Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems by Aurelien Géron
  • Practical Statistics for Data Scientists: 50 Essential Concepts by Peter Bruce & Andrew Bruce
  • Hands-On Programming with R: Write Your Own Functions And Simulations by Garrett Grolemund & Hadley Wickham
  • An Introduction to Statistical Learning: with Applications in R by Gareth James et al.
  • Deep Learning with R by François Chollet & J.J. Allaire
  • Deep Learning with Python by François Chollet

by FeedBurner

05 - Presentations

Making slides with code, tom mock | 2022-07-25, quarto presentation formats.

  • revealjs - essentially the replacement for xaringan , but with Pandoc-native syntax
  • beamer for LaTex slides
  • Powerpoint for when you have to collaborate via Office
reveal.js is an open source HTML presentation framework. It’s a tool that enables anyone with a web browser to create fully-featured and beautiful presentations for free.

revealjs for Quarto is a framework for turning Pandoc-friendly markdown + code into beautiful slides

User guide: https://quarto.org/docs/presentations/revealjs/

Core workflow

  • Open materials/workshop/05-presentations/revealjs-penguins.qmd
  • Explore the code
  • Add a new slide with a level 2 header and some text

YAML for these slides

Transitions, slide numbering, presentation preview.

  • In the latest version of RStudio, Quarto revealjs presentations will open up as a “background job” in the Presentation tab.

create presentations using r

  • Using RStudio, create a new revealjs Quarto presentation
  • author for your name
  • titled “My first Quarto Presentation!”
  • Add slide numbering (what do the different types mean?)
  • Write out what you did this morning (woke up, ate breakfast, walked to this room, etc) in sub-sections
  • New sections should have level 2 headers
  • Add a code chunk
  • Link out to an image with markdown syntax

revealjs vs xaringan

  • xaringan for RMarkdown uses only knitr and remark.js , without Pandoc and with some Pandoc-incompatabilities
  • revealjs was a lesser known RMarkdown package, but is the primary HTML slide generator for Quarto

If you loved xaringan , you’ll love revealjs !

Presentation Visual Editor

Unlike xaringan , Quarto + revealjs can be edited with the RStudio Visual Editor!

create presentations using r

Separate slides

Level 2 header = new slide

Level 1 header = new slide and new section

  • --- can also delineate slides via horizontal rules or leave the heading “blank” for untitled slides

Reminder about pandoc div and spans

  • Create lists with - or * or 1.

Incrementally reveal elements with:

Or affect globally:

Or turn it off for specific lists

Incremental lists

  • Second item

Incremental reveal

Not limited to just bullet points…

Use . . . syntax to indicate a break at an arbitrary location

You can also make a point with fragments

Highlight red

Fade in, then out

Slide up while fading in

Fragments, nesting

Fragments can be nested to affect the same “text” multiple times

Fade in > Turn red > Semi fade out

Fragments, spans

This is an important sentence!

Mind the gap when riding the rail!

Fragments, order

Appears last

Appears first

Appears second

  • Open materials/workshop/05-presentation/fragments.qmd
  • Make the portions appear in order: top -> bottom and left -> right

Column layout

On the left

On the right

Output location, column-fragment

create presentations using r

Output location, column

create presentations using r

Output location, fragment

create presentations using r

Output location, slide

create presentations using r

Column Layout, arbitrary fragment

If you try . . . syntax WITH ::: {.columns} - it won’t be incremental… BUT:

These appear first

You can nest .incremental + .fragment to get your expected behavior.

  • Create a new presentation with RStudio> New Quarto Presentation
  • Create two columns with the ::: {.columns} and use .fragment tags on the columns for incremental reveal of those columns

create presentations using r

Stack layout

Incremental reveal of images/content

create presentations using r

Fit Text {.r-fit-text}

Stretch images {.r-stretch}.

Fit to the remaining space - this is the default behavior in revealjs

create presentations using r

Title Slide, YAML edition

Title slide, diy, logo and footer.

A footer can also be set by slide with:

https://themockup.blog

Slide alignment

  • Heading level one will be center-aligned
  • Heading level two will be left-aligned

Right aligned!

  • Some bullets
  • Another bullet

Slide backgrounds, color

Slide backgrounds, images.

Note, you may need to set a background-color to black/white to “force” the text to contrast.

Footnotes in presentations are placed at the bottom of the slide and numbered.

For example, did you know that Howard is a dog 1 ?

He also likes to sleep 2

Asides are like footnotes, but don’t have numbers 1 .

  • Create a new revealjs presentation
  • Aside/footnote
  • Tabset with code and output (two options on how!)
  • Code highlighting walking through at least two lines
  • A slide with an image as the background

Code line-highlighting

Use #| code-line-numbers: "3" syntax - will highlight line and fade other lines

create presentations using r

Sometimes you want to make a point though…

create presentations using r

And I often want to “walk through” a set of code!

create presentations using r

Themes/Appearance

https://quarto.org/docs/presentations/revealjs/themes.html

Arbitrary HTML + Position absolute

Position = absolute, position = .absolute.

create presentations using r

Position .absolute

Auto-animate.

Automatically animate matching elements across slides with Auto-Animate.

create presentations using r

Get started with Quarto

Top searches

Trending searches

create presentations using r

islamic history

36 templates

create presentations using r

19 templates

create presentations using r

online shopping

21 templates

create presentations using r

environmental sustainability

121 templates

create presentations using r

cybersecurity

6 templates

create presentations using r

29 templates

Create your presentation

Writing tone, number of slides.

create presentations using r

AI presentation maker

When lack of inspiration or time constraints are something you’re worried about, it’s a good idea to seek help. Slidesgo comes to the rescue with its latest functionality—the AI presentation maker! With a few clicks, you’ll have wonderful slideshows that suit your own needs . And it’s totally free!

create presentations using r

Generate presentations in minutes

We humans make the world move, but we need to sleep, rest and so on. What if there were someone available 24/7 for you? It’s time to get out of your comfort zone and ask the AI presentation maker to give you a hand. The possibilities are endless : you choose the topic, the tone and the style, and the AI will do the rest. Now we’re talking!

Customize your AI-generated presentation online

Alright, your robotic pal has generated a presentation for you. But, for the time being, AIs can’t read minds, so it’s likely that you’ll want to modify the slides. Please do! We didn’t forget about those time constraints you’re facing, so thanks to the editing tools provided by one of our sister projects —shoutouts to Wepik — you can make changes on the fly without resorting to other programs or software. Add text, choose your own colors, rearrange elements, it’s up to you! Oh, and since we are a big family, you’ll be able to access many resources from big names, that is, Freepik and Flaticon . That means having a lot of images and icons at your disposal!

create presentations using r

How does it work?

Think of your topic.

First things first, you’ll be talking about something in particular, right? A business meeting, a new medical breakthrough, the weather, your favorite songs, a basketball game, a pink elephant you saw last Sunday—you name it. Just type it out and let the AI know what the topic is.

Choose your preferred style and tone

They say that variety is the spice of life. That’s why we let you choose between different design styles, including doodle, simple, abstract, geometric, and elegant . What about the tone? Several of them: fun, creative, casual, professional, and formal. Each one will give you something unique, so which way of impressing your audience will it be this time? Mix and match!

Make any desired changes

You’ve got freshly generated slides. Oh, you wish they were in a different color? That text box would look better if it were placed on the right side? Run the online editor and use the tools to have the slides exactly your way.

Download the final result for free

Yes, just as envisioned those slides deserve to be on your storage device at once! You can export the presentation in .pdf format and download it for free . Can’t wait to show it to your best friend because you think they will love it? Generate a shareable link!

What is an AI-generated presentation?

It’s exactly “what it says on the cover”. AIs, or artificial intelligences, are in constant evolution, and they are now able to generate presentations in a short time, based on inputs from the user. This technology allows you to get a satisfactory presentation much faster by doing a big chunk of the work.

Can I customize the presentation generated by the AI?

Of course! That’s the point! Slidesgo is all for customization since day one, so you’ll be able to make any changes to presentations generated by the AI. We humans are irreplaceable, after all! Thanks to the online editor, you can do whatever modifications you may need, without having to install any software. Colors, text, images, icons, placement, the final decision concerning all of the elements is up to you.

Can I add my own images?

Absolutely. That’s a basic function, and we made sure to have it available. Would it make sense to have a portfolio template generated by an AI without a single picture of your own work? In any case, we also offer the possibility of asking the AI to generate images for you via prompts. Additionally, you can also check out the integrated gallery of images from Freepik and use them. If making an impression is your goal, you’ll have an easy time!

Is this new functionality free? As in “free of charge”? Do you mean it?

Yes, it is, and we mean it. We even asked our buddies at Wepik, who are the ones hosting this AI presentation maker, and they told us “yup, it’s on the house”.

Are there more presentation designs available?

From time to time, we’ll be adding more designs. The cool thing is that you’ll have at your disposal a lot of content from Freepik and Flaticon when using the AI presentation maker. Oh, and just as a reminder, if you feel like you want to do things yourself and don’t want to rely on an AI, you’re on Slidesgo, the leading website when it comes to presentation templates. We have thousands of them, and counting!.

How can I download my presentation?

The easiest way is to click on “Download” to get your presentation in .pdf format. But there are other options! You can click on “Present” to enter the presenter view and start presenting right away! There’s also the “Share” option, which gives you a shareable link. This way, any friend, relative, colleague—anyone, really—will be able to access your presentation in a moment.

Discover more content

This is just the beginning! Slidesgo has thousands of customizable templates for Google Slides and PowerPoint. Our designers have created them with much care and love, and the variety of topics, themes and styles is, how to put it, immense! We also have a blog, in which we post articles for those who want to find inspiration or need to learn a bit more about Google Slides or PowerPoint. Do you have kids? We’ve got a section dedicated to printable coloring pages! Have a look around and make the most of our site!

R Markdown: The Definitive Guide

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

Two sample slides in a Slidy presentation.

FIGURE 4.2: Two sample slides in a Slidy presentation.

4.2.1 Display modes

The following single character keyboard shortcuts enable alternate display modes:

  • 'C' : Show table of contents (the right sub-figure in Figure 4.2 has shown the 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 .

4.2.2 Text size

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

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

4.2.4 Other features

Refer to Section 3.1 for the documentation of other features of Slidy presentations, including figure options (Section 3.1.5 ), appearance and style (Section 3.1.4 ), 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 ), custom templates (Section 3.1.10.3 ), Pandoc arguments (Section 3.1.10.5 ), and shared options (Section 3.1.11 ).

Slidy presentations have several features in common with ioslides presentations in Section 4.1 . For incremental bullets, see Section 4.1.2 . For custom CSS, see Section 4.1.3.5 . For printing Slidy slides to PDF, see Section 4.1.10 .

Our approach

  • Responsibility
  • Infrastructure
  • Try Meta AI

RECOMMENDED READS

  • 5 Steps to Getting Started with Llama 2
  • The Llama Ecosystem: Past, Present, and Future
  • Introducing Code Llama, a state-of-the-art large language model for coding
  • Meta and Microsoft Introduce the Next Generation of Llama
  • Today, we’re introducing Meta Llama 3, the next generation of our state-of-the-art open source large language model.
  • Llama 3 models will soon be available on AWS, Databricks, Google Cloud, Hugging Face, Kaggle, IBM WatsonX, Microsoft Azure, NVIDIA NIM, and Snowflake, and with support from hardware platforms offered by AMD, AWS, Dell, Intel, NVIDIA, and Qualcomm.
  • We’re dedicated to developing Llama 3 in a responsible way, and we’re offering various resources to help others use it responsibly as well. This includes introducing new trust and safety tools with Llama Guard 2, Code Shield, and CyberSec Eval 2.
  • In the coming months, we expect to introduce new capabilities, longer context windows, additional model sizes, and enhanced performance, and we’ll share the Llama 3 research paper.
  • Meta AI, built with Llama 3 technology, is now one of the world’s leading AI assistants that can boost your intelligence and lighten your load—helping you learn, get things done, create content, and connect to make the most out of every moment. You can try Meta AI here .

Today, we’re excited to share the first two models of the next generation of Llama, Meta Llama 3, available for broad use. This release features pretrained and instruction-fine-tuned language models with 8B and 70B parameters that can support a broad range of use cases. This next generation of Llama demonstrates state-of-the-art performance on a wide range of industry benchmarks and offers new capabilities, including improved reasoning. We believe these are the best open source models of their class, period. In support of our longstanding open approach, we’re putting Llama 3 in the hands of the community. We want to kickstart the next wave of innovation in AI across the stack—from applications to developer tools to evals to inference optimizations and more. We can’t wait to see what you build and look forward to your feedback.

Our goals for Llama 3

With Llama 3, we set out to build the best open models that are on par with the best proprietary models available today. We wanted to address developer feedback to increase the overall helpfulness of Llama 3 and are doing so while continuing to play a leading role on responsible use and deployment of LLMs. We are embracing the open source ethos of releasing early and often to enable the community to get access to these models while they are still in development. The text-based models we are releasing today are the first in the Llama 3 collection of models. Our goal in the near future is to make Llama 3 multilingual and multimodal, have longer context, and continue to improve overall performance across core LLM capabilities such as reasoning and coding.

State-of-the-art performance

Our new 8B and 70B parameter Llama 3 models are a major leap over Llama 2 and establish a new state-of-the-art for LLM models at those scales. Thanks to improvements in pretraining and post-training, our pretrained and instruction-fine-tuned models are the best models existing today at the 8B and 70B parameter scale. Improvements in our post-training procedures substantially reduced false refusal rates, improved alignment, and increased diversity in model responses. We also saw greatly improved capabilities like reasoning, code generation, and instruction following making Llama 3 more steerable.

create presentations using r

*Please see evaluation details for setting and parameters with which these evaluations are calculated.

In the development of Llama 3, we looked at model performance on standard benchmarks and also sought to optimize for performance for real-world scenarios. To this end, we developed a new high-quality human evaluation set. This evaluation set contains 1,800 prompts that cover 12 key use cases: asking for advice, brainstorming, classification, closed question answering, coding, creative writing, extraction, inhabiting a character/persona, open question answering, reasoning, rewriting, and summarization. To prevent accidental overfitting of our models on this evaluation set, even our own modeling teams do not have access to it. The chart below shows aggregated results of our human evaluations across of these categories and prompts against Claude Sonnet, Mistral Medium, and GPT-3.5.

create presentations using r

Preference rankings by human annotators based on this evaluation set highlight the strong performance of our 70B instruction-following model compared to competing models of comparable size in real-world scenarios.

Our pretrained model also establishes a new state-of-the-art for LLM models at those scales.

create presentations using r

To develop a great language model, we believe it’s important to innovate, scale, and optimize for simplicity. We adopted this design philosophy throughout the Llama 3 project with a focus on four key ingredients: the model architecture, the pretraining data, scaling up pretraining, and instruction fine-tuning.

Model architecture

In line with our design philosophy, we opted for a relatively standard decoder-only transformer architecture in Llama 3. Compared to Llama 2, we made several key improvements. Llama 3 uses a tokenizer with a vocabulary of 128K tokens that encodes language much more efficiently, which leads to substantially improved model performance. To improve the inference efficiency of Llama 3 models, we’ve adopted grouped query attention (GQA) across both the 8B and 70B sizes. We trained the models on sequences of 8,192 tokens, using a mask to ensure self-attention does not cross document boundaries.

Training data

To train the best language model, the curation of a large, high-quality training dataset is paramount. In line with our design principles, we invested heavily in pretraining data. Llama 3 is pretrained on over 15T tokens that were all collected from publicly available sources. Our training dataset is seven times larger than that used for Llama 2, and it includes four times more code. To prepare for upcoming multilingual use cases, over 5% of the Llama 3 pretraining dataset consists of high-quality non-English data that covers over 30 languages. However, we do not expect the same level of performance in these languages as in English.

To ensure Llama 3 is trained on data of the highest quality, we developed a series of data-filtering pipelines. These pipelines include using heuristic filters, NSFW filters, semantic deduplication approaches, and text classifiers to predict data quality. We found that previous generations of Llama are surprisingly good at identifying high-quality data, hence we used Llama 2 to generate the training data for the text-quality classifiers that are powering Llama 3.

We also performed extensive experiments to evaluate the best ways of mixing data from different sources in our final pretraining dataset. These experiments enabled us to select a data mix that ensures that Llama 3 performs well across use cases including trivia questions, STEM, coding, historical knowledge, etc.

Scaling up pretraining

To effectively leverage our pretraining data in Llama 3 models, we put substantial effort into scaling up pretraining. Specifically, we have developed a series of detailed scaling laws for downstream benchmark evaluations. These scaling laws enable us to select an optimal data mix and to make informed decisions on how to best use our training compute. Importantly, scaling laws allow us to predict the performance of our largest models on key tasks (for example, code generation as evaluated on the HumanEval benchmark—see above) before we actually train the models. This helps us ensure strong performance of our final models across a variety of use cases and capabilities.

We made several new observations on scaling behavior during the development of Llama 3. For example, while the Chinchilla-optimal amount of training compute for an 8B parameter model corresponds to ~200B tokens, we found that model performance continues to improve even after the model is trained on two orders of magnitude more data. Both our 8B and 70B parameter models continued to improve log-linearly after we trained them on up to 15T tokens. Larger models can match the performance of these smaller models with less training compute, but smaller models are generally preferred because they are much more efficient during inference.

To train our largest Llama 3 models, we combined three types of parallelization: data parallelization, model parallelization, and pipeline parallelization. Our most efficient implementation achieves a compute utilization of over 400 TFLOPS per GPU when trained on 16K GPUs simultaneously. We performed training runs on two custom-built 24K GPU clusters . To maximize GPU uptime, we developed an advanced new training stack that automates error detection, handling, and maintenance. We also greatly improved our hardware reliability and detection mechanisms for silent data corruption, and we developed new scalable storage systems that reduce overheads of checkpointing and rollback. Those improvements resulted in an overall effective training time of more than 95%. Combined, these improvements increased the efficiency of Llama 3 training by ~three times compared to Llama 2.

Instruction fine-tuning

To fully unlock the potential of our pretrained models in chat use cases, we innovated on our approach to instruction-tuning as well. Our approach to post-training is a combination of supervised fine-tuning (SFT), rejection sampling, proximal policy optimization (PPO), and direct preference optimization (DPO). The quality of the prompts that are used in SFT and the preference rankings that are used in PPO and DPO has an outsized influence on the performance of aligned models. Some of our biggest improvements in model quality came from carefully curating this data and performing multiple rounds of quality assurance on annotations provided by human annotators.

Learning from preference rankings via PPO and DPO also greatly improved the performance of Llama 3 on reasoning and coding tasks. We found that if you ask a model a reasoning question that it struggles to answer, the model will sometimes produce the right reasoning trace: The model knows how to produce the right answer, but it does not know how to select it. Training on preference rankings enables the model to learn how to select it.

Building with Llama 3

Our vision is to enable developers to customize Llama 3 to support relevant use cases and to make it easier to adopt best practices and improve the open ecosystem. With this release, we’re providing new trust and safety tools including updated components with both Llama Guard 2 and Cybersec Eval 2, and the introduction of Code Shield—an inference time guardrail for filtering insecure code produced by LLMs.

We’ve also co-developed Llama 3 with torchtune , the new PyTorch-native library for easily authoring, fine-tuning, and experimenting with LLMs. torchtune provides memory efficient and hackable training recipes written entirely in PyTorch. The library is integrated with popular platforms such as Hugging Face, Weights & Biases, and EleutherAI and even supports Executorch for enabling efficient inference to be run on a wide variety of mobile and edge devices. For everything from prompt engineering to using Llama 3 with LangChain we have a comprehensive getting started guide and takes you from downloading Llama 3 all the way to deployment at scale within your generative AI application.

A system-level approach to responsibility

We have designed Llama 3 models to be maximally helpful while ensuring an industry leading approach to responsibly deploying them. To achieve this, we have adopted a new, system-level approach to the responsible development and deployment of Llama. We envision Llama models as part of a broader system that puts the developer in the driver’s seat. Llama models will serve as a foundational piece of a system that developers design with their unique end goals in mind.

create presentations using r

Instruction fine-tuning also plays a major role in ensuring the safety of our models. Our instruction-fine-tuned models have been red-teamed (tested) for safety through internal and external efforts. ​​Our red teaming approach leverages human experts and automation methods to generate adversarial prompts that try to elicit problematic responses. For instance, we apply comprehensive testing to assess risks of misuse related to Chemical, Biological, Cyber Security, and other risk areas. All of these efforts are iterative and used to inform safety fine-tuning of the models being released. You can read more about our efforts in the model card .

Llama Guard models are meant to be a foundation for prompt and response safety and can easily be fine-tuned to create a new taxonomy depending on application needs. As a starting point, the new Llama Guard 2 uses the recently announced MLCommons taxonomy, in an effort to support the emergence of industry standards in this important area. Additionally, CyberSecEval 2 expands on its predecessor by adding measures of an LLM’s propensity to allow for abuse of its code interpreter, offensive cybersecurity capabilities, and susceptibility to prompt injection attacks (learn more in our technical paper ). Finally, we’re introducing Code Shield which adds support for inference-time filtering of insecure code produced by LLMs. This offers mitigation of risks around insecure code suggestions, code interpreter abuse prevention, and secure command execution.

With the speed at which the generative AI space is moving, we believe an open approach is an important way to bring the ecosystem together and mitigate these potential harms. As part of that, we’re updating our Responsible Use Guide (RUG) that provides a comprehensive guide to responsible development with LLMs. As we outlined in the RUG, we recommend that all inputs and outputs be checked and filtered in accordance with content guidelines appropriate to the application. Additionally, many cloud service providers offer content moderation APIs and other tools for responsible deployment, and we encourage developers to also consider using these options.

Deploying Llama 3 at scale

Llama 3 will soon be available on all major platforms including cloud providers, model API providers, and much more. Llama 3 will be everywhere .

Our benchmarks show the tokenizer offers improved token efficiency, yielding up to 15% fewer tokens compared to Llama 2. Also, Group Query Attention (GQA) now has been added to Llama 3 8B as well. As a result, we observed that despite the model having 1B more parameters compared to Llama 2 7B, the improved tokenizer efficiency and GQA contribute to maintaining the inference efficiency on par with Llama 2 7B.

For examples of how to leverage all of these capabilities, check out Llama Recipes which contains all of our open source code that can be leveraged for everything from fine-tuning to deployment to model evaluation.

What’s next for Llama 3?

The Llama 3 8B and 70B models mark the beginning of what we plan to release for Llama 3. And there’s a lot more to come.

Our largest models are over 400B parameters and, while these models are still training, our team is excited about how they’re trending. Over the coming months, we’ll release multiple models with new capabilities including multimodality, the ability to converse in multiple languages, a much longer context window, and stronger overall capabilities. We will also publish a detailed research paper once we are done training Llama 3.

To give you a sneak preview for where these models are today as they continue training, we thought we could share some snapshots of how our largest LLM model is trending. Please note that this data is based on an early checkpoint of Llama 3 that is still training and these capabilities are not supported as part of the models released today.

create presentations using r

We’re committed to the continued growth and development of an open AI ecosystem for releasing our models responsibly. We have long believed that openness leads to better, safer products, faster innovation, and a healthier overall market. This is good for Meta, and it is good for society. We’re taking a community-first approach with Llama 3, and starting today, these models are available on the leading cloud, hosting, and hardware platforms with many more to come.

Try Meta Llama 3 today

We’ve integrated our latest models into Meta AI, which we believe is the world’s leading AI assistant. It’s now built with Llama 3 technology and it’s available in more countries across our apps.

You can use Meta AI on Facebook, Instagram, WhatsApp, Messenger, and the web to get things done, learn, create, and connect with the things that matter to you. You can read more about the Meta AI experience here .

Visit the Llama 3 website to download the models and reference the Getting Started Guide for the latest list of all available platforms.

You’ll also soon be able to test multimodal Meta AI on our Ray-Ban Meta smart glasses.

As always, we look forward to seeing all the amazing products and experiences you will build with Meta Llama 3.

Our latest updates delivered to your inbox

Subscribe to our newsletter to keep up with Meta AI news, events, research breakthroughs, and more.

Join us in the pursuit of what’s possible with AI.

create presentations using r

Product experiences

Foundational models

Latest news

Meta © 2024

How-To Geek

I use conditional formatting in most spreadsheets: here's why.

Conditional formatting is a non-negotiable.

Quick Links

How do you access the conditional formatting tool, conditional formatting can highlight certain values, conditional formatting works with changing data, you can compare data easily, things to note.

Manually highlighting values in large data sets can be both time-consuming and error-prone, especially if your data is likely to change over time. With that in mind, using conditional formatting can help eliminate these two hurdles.

Conditional formatting formats a cell or a range of cells based on conditions you have applied. In the examples below, I will show you some everyday uses of this incredibly useful tool, so you can let Excel do the hard work for you.

To access the conditional formatting tool, highlight the cell or cells you want to format, and in the Home tab on the ribbon, click "Conditional Formatting" in the Styles group. From there, you'll see the many different options available.

I'm not going to run through every use of conditional formatting, as there are hundreds! Instead, I want to share with you a few practical uses that you can apply to everyday tasks.

Among its many uses, Excel is best known for its ability to present and organize data for you to use and analyze. To make the analysis process much easier, you can use conditional formatting to highlight cells containing certain values, unique or duplicated cells, highest and lowest values within a data set, and in many other similar scenarios.

Highlighting Cells Containing Certain Values

Let's say you're organizing a party, and you've taken everybody's food orders. You now want Excel to highlight every steak order, as you need to ask the guests how they like it cooked.

First, select the data that you're applying the condition to—in this case, it's the whole of column C. Then, in the Conditional Formatting drop-down menu, click "New Rule."

In the dialog box, click "Format Only Cells That Contain," and in the first drop-down option, select "Specific Text." Make sure you click "Containing" in the next drop-down box, but note the other options that you can also use at this stage. Then, in the empty field box, type the text you want to highlight within your selected cells—in our case, it's "Steak"—and then create the formatting you want for these cells by clicking "Format." Once you're done, click "OK."

Now, all cells containing "Steak" will be highlighted in yellow.

Highlighting Unique or Duplicated Cells

You can use conditional formatting to easily identify duplicates or anomalies in a data set. This is a really effective way of efficiently cleaning up your spreadsheet. I use this tool all the time on my vacation packing list. As I'm always adding to it and accessing it both on my computer and on the move through OneDrive , I sometimes accidentally add items that are already there.

To automatically highlight duplicated cells , select the relevant data, and in the Conditional Formatting drop-down menu, click "New Rule."

In the resultant dialog box, click "Format Only Unique Or Duplicate Values," and in the drop-down, select "Duplicate." Define the formatting you want for these cells by clicking "Format." Once you're done, click "OK."

This is how my vacation packing list looks when I apply this tool.

I can now go and delete one of each item that is duplicated. And because the conditional formatting is adaptable, as soon as I delete a duplicate, the other also loses its formatting (as it's no longer a duplicate). As a result, I'll end up with a nice, tidy spreadsheet.

You can also do the same with unique cells—that is, cells that contain data different to the rest of the array. Simply click "Unique" instead of "Duplicate" in the relevant drop-down menu.

Highlighting the Highest and Lowest Values

As an avid football fan, I like to rate players based on their performance in each game, and then easily see who has played consistently well. To do this, I make Excel automatically highlight the highest two ratings for each game.

First, select the data range you want to evaluate. In my case, it will be the first column containing data. I don't want to select all the data in my table, as then that will highlight the highest two ratings across all games, whereas I want to do this for each game individually.

Then, in the Conditional Formatting menu, click "New Rule." In the dialog box, click "Format Only Top Or Bottom Ranked Values," and in the drop-down option, select "Top" (or click "Bottom" if you want to highlight the lowest values). Next, in the number field, type the parameters of your conditions. For example, if you click "1", this will highlight the single top value in your data. Also check the "%" box if you want to state your parameters as a percentage. Create the formatting you want for these cells, and once you're done, click "OK."

This is how my sheet will look. Notice how five scores have been highlighted, as more than two people achieved the high-score parameter I set in my rule.

Next, you should use the Format Painter to apply the same conditions to the next column, and then change the formatting of the values meeting your criteria, so that it's distinguishable from the first column.

In the first section, we formatted cells containing a set value, but Excel also lets you easily change the parameters for formatting your cells without having to amend the rules.

For example, let's assume we have various household jobs that need to be completed, and we've assigned each job to a family member on each day. We now want to see all the jobs that a certain family member has been assigned.

To do this, first select all the data you want to search. Then, in the Conditional Formatting menu, click "New Rule." In the dialog box, click "Format Only Cells That Contain," and in the first drop-down option, select "Cell Value." Next, in the second drop-down field, click "Equal To." Then, click the text field, before clicking the cell that you're going to use as your variable parameter. In our case, that's B1. Finally, create the formatting you want for these cells, and click "OK."

Then, in the cell you selected in your conditional formatting rule, type a word or number that matches some of the data in your table to see each case of that word or number being highlighted.

You could also choose the variable value from a drop-down list you create in Excel .

So far, I've talked about how conditional formatting can help you to identify certain values within a set of data. However, conditional formatting is equally useful for comparing numbers within a range .

Going back to the football player ratings from earlier, rather than highlighting the highest or lowest values, let's compare how all the players performed.

First, select the data you want to use. In our case, it's the ratings from the first game in column B. Then, in the Conditional Formatting drop-down, choose from the three following options:

  • Data Bars (see screenshot below)—This partly fills each cell depending on the value compared to the others in the range. The cells containing the highest value will be fully filled, and the cells with the lowest value will be fractionally filled.
  • Color Scales—This colors the cells in a gradient depending on the values they contain.
  • Icon Sets—This adds different icons depending on the cell values.

If you do, indeed, get the conditional formatting bug and find that you use it in most of your spreadsheets as I do, then there are a few small things to note.

  • The more conditional formatting you include (or the larger your data set containing conditional formatting), the slower things might become in your spreadsheet. This is because Excel has to apply the conditions to each cell individually, and if you have lots of rules, this can take some time. There's no issue with this if you're willing to wait, but if you're looking to work speedily, it's worth limiting its use.
  • Be careful with overlapping rules, especially if you inadvertently apply contradicting conditions to a cell. Make sure you know exactly where your existing formatting rules are before adding new ones.
  • Adding rows and columns or moving things around where conditional formatting is already in place can cause problems. As with the previous point, make sure you know where you have already placed some rules, and double-check that they are where you want them to be after making changes to your sheet's layout.

In the Conditional Formatting drop-down list, you can also manage the rules applied to your sheet , and you can also clear rules from selected cells, the entire sheet, or a table.

COMMENTS

  1. Making a Presentation in R: Getting started

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

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

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

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

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

  6. R for the Rest of Us: A Statistics-Free Introduction

    Next, navigate to File > New File > R Markdown to create a new project. Choose the From Template tab and select the template called Ninja Presentation, then click OK. You should get an R Markdown document containing some default content. Delete this and add the penguin R report you created in Chapter 6.

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

  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 a Unique and Beautiful Presentation using R ...

    To create a reveal.js presentation from R Markdown you specify the revealjs_presentation output format in the front-matter of your document. For more details and information, check out reveal.js

  10. Creating presentations

    Step 1: Open a project. After you have done this, a little pop-up helper will appear. The first thing we will do is to select the {iheiddown} template for our presentation. To do so, click on the "From Template" option on the left and select the "Presentation {iheiddown}" template. Now give your presentation a name and click on "OK".

  11. Creating a presentation with R

    Contents Slidify 1. Install and Initialize 2. Author and Edit 2.1 Add slide content 2.1 Change the look and feel 2.1 Collection of links 3. Generate and Publish 4. Summary Slidify As a LaTeX fan, I started early to write my presentations with the Beamer document class. Unfortunately, the default classes are starting to look rather antique today and lack the possibility to implement a lot of ...

  12. 4.4 PowerPoint presentation

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

  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. Create PowerPoint reports with R. The best PowerPoint presentations

    library(officer) Next, we'll create a PowerPoint object in R using the read_pptxfunction. pres <- read_pptx() To add a slide, we use the add_slide function. It requires 3 arguments: an rpptx ...

  15. Authoring R Presentations

    To create a new R Presentation you execute the New File -> R Presentation command: After specifying the location to save the presentation, a new presentation will be created and a preview will show within the Presentation tab in the upper right corner of the IDE. Slide Basics.

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

  17. Gamma App: Generate AI Presentations, Webpages & Docs

    Create a working presentation, document or webpage you can refine and customize in under a minute, using our powerful AI generator. Gamma allows me to package up information in ways I can't with slides, while still creating good flow for my presentations. Ann Marie, Director of Product at Koalafi.

  18. Programmatically create interactive Powerpoint slides with R

    PowerPointR. The tutorial is in three parts: The basics: using the Powerpoint API to create slides and add content (with some use of VBA for animations). Getting data: scraping data from IMDB on Clint Eastwood films and earnings. This part isn't specific to Powerpoint, and of course you can use any data you like in a presentation.

  19. Create and format PowerPoint documents from R software

    addFlexTable () function is used to format and add a table into the PowerPoint. It can be used as follow : STEP 1 : Create a table using FlexTable () or vanilla.table () function. These two functions generate a 'flexible' table which can be easily formatted before adding into the slide.

  20. Get Started with Quarto

    Using RStudio, create a new revealjs Quarto presentation; Change YAML: author for your name; titled "My first Quarto Presentation!" Add slide numbering (what do the different types mean?) Write out what you did this morning (woke up, ate breakfast, walked to this room, etc) in sub-sections; New sections should have level 2 headers; Add a ...

  21. Free AI presentation maker

    Slidesgo comes to the rescue with its latest functionality—the AI presentation maker! With a few clicks, you'll have wonderful slideshows that suit your own needs. And it's totally free! How does it work? Try for free our new AI Presentation Generator and create a customizable template in seconds. Explore beyond PowerPoint.

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

  23. Elevate Future Presentations with Cutting-Edge Technology

    Data is often a crucial part of presentations, but raw numbers can be dull. By using data visualization tools, you can transform complex data sets into clear, compelling graphics that tell a story.

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

  25. How to use GenAI to create a work presentation.

    3. Create content. Start by identifying your topic. You may already have a clear idea of what this should be, or you can brainstorm ideas using ChatGPT or Gemini. Use prompts such as: "Suggest five ideas for a theme for a slide show presentation, aimed at an audience of HR professionals looking to source a new email provider for their ...

  26. 6 Ways to Create More Interactive PowerPoint Presentations

    Engage your audience with cool, actionable features. 2. Embed Microsoft Forms (Education or Business Only) If you plan to send your PPT presentation to others—for example, if you're a trainer sending step-by-step instruction presentation, a teacher sending an independent learning task to your students, or a campaigner for your local councilor sending a persuasive PPT to constituents—you ...

  27. What Is Copilot Pro and How Do You Use It?

    Copilot is one of the tools that can help you plan a presentation. Click the "Copilot" button in the ribbon of the Home tab. Then, describe the presentation you want it to create. In our example, we typed: Create a presentation about procrastination, including what it is, what causes it, and how to overcome it.

  28. Introducing Meta Llama 3: The most capable openly available LLM to date

    Llama Guard models are meant to be a foundation for prompt and response safety and can easily be fine-tuned to create a new taxonomy depending on application needs. As a starting point, the new Llama Guard 2 uses the recently announced MLCommons taxonomy, in an effort to support the emergence of industry standards in this important area.

  29. I Use Conditional Formatting in Most Spreadsheets: Here's Why

    Next, in the second drop-down field, click "Equal To." Then, click the text field, before clicking the cell that you're going to use as your variable parameter. In our case, that's B1. Finally, create the formatting you want for these cells, and click "OK."