Presentation Tools

Output Formats

R Markdown can be used to output a wide range of formats. We have already seen a bunch of these including documents (html, pdf, word, handout), html files with built-in interactive widgets, Shiny apps, and dashboards. There is a nice gallery to showcase all of these formats, as well as a list.

Note: The newest presentation tool available (as of 2022) is Quarto, which is a generalization of R Markdown format. It allows you to weave R, Python, Julia, and other code and output with marked up text. This is incredibly important as most organizations use a combination of computational tools. While we will still refer to R Markdown below, many of the same formats listed below are available in Quarto, which is probably the soon-to-be future standard. See https://quarto.org/ for more information.

Slides

There are many different ways to write slide packages in RStudio. Advantages of all of these methods are that (i) the output is an html or pdf, so it is easy to put on a website and access from anywhere, and (ii) you have already done all of your wrangling, graphics, etc. in R. So you do not need to cut and paste graphics or code clippings or anything else from RStudio into another software package like PowerPoint or Google Docs. The main disadvantage is that there is not a drag and drop way to arrange slides for these types of presentations. So if you want an image to be of a certain size at a certain location of the slide, you’ll have to input those specifications, as opposed to stretching and moving with a cursor.

If you are interested in trying to write your presentation in R Markdown (or Quarto), my suggestion is to pick one of the formats below, download a template (I’ve linked to a bunch), make sure you can compile it from R Markdown, and then start editing.

Slide presentation formats built in to R Markdown

  • ioslides_presentation, an HTML presentation. Just need to include output: ioslides_presentation in the header of your Rmd file and then an option will appear to Knit to HTML (ioslides). Here is the documentation, an example, and the Rmd for the example. These files are from one of Garret Grolemund’s repositories here.
  • slidy_presentation, an HTML presentation. Same thing as above. Just include output: slidy_presentation and an option will appear to Knit to HTML (Slidy). Here is the documentation.
  • beamer_presentation, a PDF presentation with LaTeX Beamer. Same as above again. Just include output: beamer_presentation and then you can Knit to PDF (Beamer).

Slide presentation formats available via other packages

  • revealjs::revealjs_presentation, an HTML presentation that requires the revealjs package. Here is the documentation, an example, and the Rmd for the example. These files are from one of Garret Grolemund’s repositories here.
  • rmdshower, an HTML presentation that requires the rmdshower package. Here is an example and the code to generate it can be found in this repository.
  • Slidify is a wrapper package that enables you to use many different types of presentations. Here is a review and a pretty good tutorial, the code for which you can find here.

Note: Within RStudio, you can also create a Quarto Presentation, which is very similar to Rmd revealjs slides. Brianna has been using Quarto Presentations this semester and finds that it works a bit easier than Rmd revealjs.

Reports / Websites

You have all used the standard output:html_document to knit your Rmd file into an html file. For your technical blog posts, you can stick to that, or try tweaking some options. Here are some examples:

  • You can change the appearance and style of the output of the html_document by changing the theme and highlight options. I’ve changed these in one knitting option above with the lumen theme and espresso highlight. You can find the full list of options here.
  • You can load the prettydoc package, and use one of its themes. You can find the full list in the documentation or this tutorial.
  • Some alternative Markdown templates
  • The bookdown package was designed to write books in R Markdown, but you can also use it write single html files or pdf handouts. I’ve been using it all semester. Here is the documentation, a tutorial video, and a bunch of books that were written with the package. Check out the list of contributors.

Here a couple others you probably will not need for this project:

  • The blogdown package helps you set up an actual blogs with multiple posts. Here is a tutorial (written in bookdown ofcourse) and an example blog.

  • The rticles package helps you use R Markdown to write an article that conforms to a specific journal’s template.

Test

Below is some sample content to test out some of these output options. I’ve set everything up in the header of this Rmd file. All you have to do is knit it with different options and check out the output html file.

A sample footnote33
How a code chunk is displayed:
Trips <- readRDS("data/2014-Q4-Trips-History-Data.rds")
Stations <- read.csv("data/DC-Stations.csv")
Graphic from ggplot:

Interactive map with the leaflet package:
Number of daily net departures for four different stations:
Table 14.4: First ten rows of the NetTraffic table.
date wday station num_departures num_arrivals total_events net_departures
2014-10-01 Wed 10th & E St NW 42 37 79 5
2014-10-01 Wed 10th & U St NW 46 27 73 19
2014-10-01 Wed 10th St & Constitution Ave NW 43 40 83 3
2014-10-01 Wed 11th & F St NW 49 42 91 7
2014-10-01 Wed 11th & K St NW 72 61 133 11
2014-10-01 Wed 11th & Kenyon St NW 57 53 110 4
2014-10-01 Wed 11th & M St NW 117 105 222 12
2014-10-01 Wed 12th & L St NW 52 54 106 -2
2014-10-01 Wed 12th & U St NW 84 89 173 -5
2014-10-01 Wed 13th & D St NE 45 53 98 -8
Visualization with dygraphs:
Alternative visualization with plotly:

  1. This is a footnote.↩︎