Site icon R-bloggers

Programmatically create interactive Powerpoint slides with R

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

  1. The basics: using the Powerpoint API to create slides and add content (with some use of VBA for animations).
  2. 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.
  3. 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.