An R Markdown document starts with a header (at the top, between the triple dashes), then alternates between text in Markdown format and chunks of R code. This document is a quick example so you can check that R has been set up correctly on your computer.

Loading the Tidyverse

Throughout the course, we will be using functions from the tidyverse package.

library(tidyverse)

Plotting some data

R Markdown documents can also include graphics and plots. As an example, here is a plot made from some data included with R, recording the number of warp breaks in two different types of wool at three different tensions. When you knit the document, you should see the plot appear in the output.

data(warpbreaks)
ggplot(warpbreaks, aes(x = tension, y = breaks, colour = wool)) +
  geom_boxplot()