2.5 Package loading

Let’s load the tidyverse package.

After you’ve installed a package, you can now load it using the library() command. For example, to load the tidyverse package, run the following code in the Console pane:

library(tidyverse)

You have to reload each package you want to use every time you open a new session of RStudio. This is a little annoying to get used to and will be your most common error as you begin. When you see an error such as

Error: could not find function

remember that this likely comes from you trying to use a function in a package that has not been loaded. Remember to run the library() function with the appropriate package to fix this error.