Chapter 3 R Packages
Before we get started, let’s make sure to install and load some necessary R packages.
3.1 What are packages?
Packages are an organized set of scripts or code that an author has compiled together.
3.2 Packages
The main packages that we will use throughout the book are:
tidyverse
: Data manipulation and visualizationpsych
: Descriptive statisticscar
: Analysis of Variance (ANOVA) source table with sums of squares type IIIknitr
: Nice, clean-looking tablescarData
: Open access datasetsMASS
: Additional open access datasetsscales
: Convert numbers into dollars
Note: The description of each package is only a description of how we will use each package. Each package can perform many more functions than described above. We recommend briefly reading them by typing ??name of package
to read each package’s help page (e.g., ??psych
).
3.3 Install R Packages
To install a package, we can enter the command install.packages("name of package")
. For example, to install the psych
package, we would type install.packages("psych")
.
3.4 Load R Packages
To load a package, we can enter the command library(name of package)
. For example, to load the psych
package, we would type library(psych)
. We won’t be loading the carData
and MASS
package as we will be extracting the datasets directly from those packages, which we will go over in the datasets chapter.