1.3 Getting started

To start using R, you should do these two things:

When you first open up RStudio, you’ll also want to install some extra packages to extend the base R functionality. You can do this in the Packages tab (next to the Plots tab in the bottom-right in Figure 1.2).

A lot of the functionality introduced in this book comes from the tidyverse family of R packages (http://tidyverse.org). So when you go to Packages, click Install, type in tidyverse, a whole collection of useful and modern packages will be installed.

Even though you’ve installed the tidyverse packages, you’ll still need to tell R when you’re about to use them. We include library(tidyverse) at the top of every script we write:

We can see that it has loaded 8 packages (ggplot2, tibble, tidyr, readr, purrr, dplyr, stringr, forcats), the number behind a package name is its version.

The “Conflicts” message is expected and can safely be ignored.1

There are a few other R packages that we use and are not part of the tidyverse, but we will introduce them as we go along. If you are incredibly curious, take a peak at Chapter 16 for a full list.

  1. It just means that when we use filter or lag, they will come from the dplyr package, rather than the stats package. We’ve never needed to use filter and lag from stats, but if you do, then use the double colon, i.e., stats::filter() or stats::lag(), as just filter() will use the dplyr one.