PowerPoint presentations from R

15-03-2019  0 Comment(s)

Regardless of the tools used for data analysis, normally the way to display the results is a Word document or a PowerPoint presentation.

 PowerPoint presentation and insert a series of graphics and text programmatically, using the OfficeR and rvg packages together. We will also take advantage of the occasion to present (for those who do not know) the ‘Pipe’ operator, very useful when nesting functions.


The OfficeR package allows you to access and manipulate Word documents and PowerPoint presentations, while rvgallows us to insert the R visualizations as Office objects that we can manipulate from the document.

Let us create a blank PowerPoint template, without slides. Then, using R, we will add slides with text and graphics.

Warning: the purpose of this post is not to produce a ‘nice’ presentation, but to show the functionality.

We will need to have the following packages installed:
– officer
– magrittr
– ggplot2
– rvg

These packages will install others because they have dependencies. We load the packages:


We will load in the R session the PowerPoint template that we saved before, and we will check the information of the ‘layout’ of the rpptx object with ‘layout_summary’, this function is also part of the OfficeR package and gives us information about the design of the slides.

Comment Here


No Comments to Show