Displaying and Distributing Presentations
R Presentations can be displayed in one of two ways:
- Inline inside the RStudio IDE
- In an external web browser
You can display your presentation inside the RStudio IDE by clicking the Preview icon at the top of the editor.
This displays the presentation within a pane in the top right corner of the IDE. From within the presentation pane you can also click the Zoom button on the toolbar to have the presentation occupy the full size of the IDE.
The advantage of this approach is that you can fluidly switch between slides and demonstrations, and even when doing demonstrations the slides are still visible for context. You can also use the
source command (described in the Slide Transitions and Navigation article) to synchronize your presentation with source files that contain code you'd like to highlight or demonstrate.
You can also display your presentation in an external web browser (Chrome, Firefox, Internet Explorer and Safari are supported). To do this you invoke the More -> View in Browser command from the presentation toolbar.
There are several advantages to external display:
- Slide transitions are animated
- You can go into fullscreen mode by pressing the F key
- You can see a navigable overview of your slides by pressing the O key.
Presentation Size Options
All presentations have a "normal" size which reflects the maximum size they can be scaled to as well as the aspect ratio they are expected to be displayed at. When displayed at alternate sizes the presentation is automatically scaled to ensure the content fits on any given display.
The default size for R presentations is a width of 960 pixels and a height of 700 pixels. This size will render coherently on almost all laptop and projector screens so in most cases should not be changed. However, if you have a non-standard aspect ratio or want to use more pixels, you can specify an alternate width and height as follows:
My Presentation ============================================ author: John Doe width: 1440 height: 900
If you intend to display your presentation principally within the RStudio IDE you should also consider the
autosize option. For example:
My Presentation ============================================ author: John Doe autosize: true
autosize option automatically adapts the size of the presentation to the size of the current pane it is being displayed in. This is especially helpful if you expect users to be viewing your presentation within the RStudio preview pane, which will have widely varying aspect ratios depending on the user's configuration.
Saving as a Standalone Web Page
You can distribute R Presentations to other users by saving them as a standalone web page. To do this you invoke the More -> Save As Web Page command from the presentation toolbar.
Presentations saved in this manner can be replayed within any web browser, and are entirely standalone (i.e. they require neither RStudio nor the original presentation source files). They also do not require an internet connection (unless a
font-import has been specified).
One final note: if a presentation makes use of MathJax for LaTeX equations, then the files required by MathJax are copied to a folder that needs to be distributed along with the presentation HTML file. For example, if the saved presentation is named
MyPresentation.html then the directory
MyPresentation_files contains the MathJax supporting files.
Publishing to RPubs
Presentations can also be published to the web using RPubs. To do this you invoke the More -> Publish to RPubs command from the presentation toolbar. Note that all documents published to RPubs are publicly visible, so you should only publish presentations that you wish to share publicly.