5.1 Getting started
In this lesson we will be using a group of packages which are part of what is known as the tidyverse
. These packages include readr
for importing data into R, dplyr
for handling common data wrangling tasks for tabular data, tidyr
which enables you to swiftly convert between different data formats (long vs. wide) for plotting and analysis, lubridate
for working with dates, and ggplot2
for visualizing data. You can load these packages individually, or you can install the entire tidyverse in one go.
The packages in the tidyverse, namely dplyr
, tidyr
and ggplot2
accept both the British (e.g. summarise) and American (e.g. summarize) spelling variants of different function and option names. For this lesson, we utilize the American spellings of different functions; however, feel free to use the regional variant for where you are teaching.
First we are going to use install.packages()
to install tidyverse
. Then we are going to load tidyverse
with the library()
function. You only need to install a package once, but you will load it each time you start a new r session.
To learn more about dplyr
and tidyr
after the workshop, you may want
to check out this handy data transformation with dplyr
cheatsheet
and this one about tidyr
.