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:

  1. tidyverse : Data manipulation and visualization
  2. psych : Descriptive statistics
  3. car : Analysis of Variance (ANOVA) source table with sums of squares type III
  4. knitr : Nice, clean-looking tables
  5. carData : Open access datasets
  6. MASS : Additional open access datasets
  7. scales: 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.