-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path00-02-r_packages.Rmd
44 lines (36 loc) · 1.78 KB
/
00-02-r_packages.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# R Packages
Before we get started, let's make sure to install and load some necessary R packages.
## What are packages?
Packages are an organized set of scripts or code that an author has compiled together.
## 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`).
## 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")`.
```{r, eval=F}
install.packages("tidyverse")
install.packages("psych")
install.packages("car")
install.packages("knitr")
install.packages("kableExtra")
install.packages("carData")
install.packages("MASS")
install.packages("scales")
```
## 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][Datasets].
```{r, echo = T, warning = F, message = F}
library(tidyverse)
library(psych)
library(car)
library(knitr)
library(kableExtra)
library(scales)
```