Solution


Package Loading


As mentioned within the Learning Material & Getting Started section, install and load the following function(s).

  library(rmarkdown)
  library(tidyverse)


During this session, we will not be using any additional data, rather only using those data sets available through the tidyverse.


Section 1: Rmarkdown Basics


Exercise 1: Open a new R markdown presentation & create 4 empty normal slides, and load the tidyverse library into the presentation

Exercise 1 Solution


Exercise 2: Load the data set msleep, from the tidyverse package & on the first slide, bullet point any 10 of the animals

Exercise 2 Solution


Exercise 3: On the second slide, numerically list the top 5 heaviest animals

Exercise 3 Solution



Section 2: Specifying Metadata


Exercise 4: In the metadata, specify the following:

  • title: “Mammals Sleep Dataset”
  • output: ioslides_presentation

Exercise 4 Solution

Exercise 5: In addition, ensure that bullet points are displayed incrementally & reduce the font size.

Exercise 5 Solution



Section 3: Structuring Presentations


Exercise 6: Restructure the first slide to divide it into 2 columns, 5 animals in each column

Exercise 6 Solution


Exercise 7: Center the text in the second slide

Exercise 7 Solution


Exercise 8: Convert the third slide to a Heading slide, labelled Sleep Relationships.

Exercise 8 Solution



Section 4: Code & Script in Presentations


Exercise 9: Insert a code chunk on slide 4, displaying a summary of columns 3 to 8 of msleep data, ensure to include the code on the slide.


Exercise 9 Solution


Exercise 10: Insert a code chunk on slide 5, which displays a scatter plot between brain weight and body weight. Which does not include the code on the slide.


Exercise 10 Solution


Exercise 11: Edit the metadata on slide 5, so that all the code can be seen and the text is built incrementally


Exercise 11 Solution



Section 5: Pre-built Presentations Themes


Exercise 12: Change the output of the presentation to: beamer_presentation.


Exercise 12 Solution


Exercise 13: Looking on the sites mentioned, add in a theme, colortheme and fonttheme.


Exercise 13 Solution




Section 6: Exporting Presentations


Exercise 14: Export the presentation through ioslide as a HTML


Exercise 14 Solution


Exercise 15: Export the presentation through beamer as a PDF


Exercise 15 Solution