Introduction

Instruction

Okay, those are the most important things you need to move on.

Every function in R comes from a package. Packages are sets of grouped functions that allow us to perform certain operations. For example, to calculate a mean, we use the mean() function; this is part of the base package in R, which is always loaded automatically whenever you launch R. The data.frame() function we saw earlier is also part of the base package.

But the base package just scratches the surface. R is very popular and allows developers like you to easily create new packages (such as for data visualization) and share them with the open-source R community.

In this course, we’ll look at tidyverse. This a bit more than a package – in fact, it’s a collection of various useful packages that allow us to manipulate and visualize data. For example, the ggplot2 data visualization package is part of tidyverse.

We will learn how to use tidyverse packages to manipulate our data (dplyr, tidyr), read data from a file (readr), and work with factors (forcats).

But before we do that, we need to learn how to load our packages. In real life (like on your computer), you first need to launch R and then install the desired package by using the install.packages() function. This function simply takes the name of the package you want to install, in string format. Here’s an example:

install.packages("ggplot2")

In our course, we’ve already installed the tidyverse packages for you. After you’ve installed a package, you simply load the package into memory using the library() function. Unlike install.packages(), the library() function does not take the name of the package in string form; it just requires the name of the package as plain text. Take a look:

library(ggplot2)

Exercise

Load the tidyverse package into memory to get started.

Stuck? Here's a hint!

Type:

library(tidyverse)