Skip to main content

Section 1.8 Packages

R is fantastic in many ways. One of, if not the most powerful aspect of R is packages. When you install R and RStudio, there are ample things you can do. But, with packages, there is an infinite amount of things you can do.
R is open source, which means that anyone can create their own code, and in turn create their own package. Packages contain functions and datasets that are not preinstalled in R but can significantly elevate the capabilities.
To install a new package in R, you run the command install.packages() then inside the parenthesis, in quotation marks, put the name of the package you’d like to install.
Once you install a package, you do not need to reinstall it (unless it needs to be updated, which R will tell you). However, if you want to use it, you need to use the library() command. This has to be done every time you start a new R session.
# install.packages("tidyverse")
# library(readxl)
# library(tidyverse)
Packages are going to be an essential part of this course, especially in the next chapter. You can find a list of all the packages here.