Download R here and then download R Studio here.
If you're working in R Studio Cloud, you need the extra step: First upload your dataset in the Files pane in the bottom right of your window. Then import the dataset as described above.
I'm using the Cereals dataset from the textbook as an example. It's available here (I edited it slightly to make it easier to read). Datasets from the text
Cereals <- read.csv("~/Ch28_Cereals.csv")
Use both the install.packages and the library command.
install.packages("ggplot2")
library("ggplot2")
## Warning: package 'ggplot2' was built under R version 3.6.3
or you can load the whole Tidyverse, which also includes commands to manipulate data like 'dplyr' and 'mutate'.
install.packages("tidyverse")
library("tidyverse")
## Warning: package 'tidyverse' was built under R version 3.6.3
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v tibble 3.0.1 v dplyr 1.0.0
## v tidyr 1.1.0 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## v purrr 0.3.4
## Warning: package 'tibble' was built under R version 3.6.3
## Warning: package 'tidyr' was built under R version 3.6.3
## Warning: package 'readr' was built under R version 3.6.3
## Warning: package 'purrr' was built under R version 3.6.3
## Warning: package 'dplyr' was built under R version 3.6.3
## Warning: package 'stringr' was built under R version 3.6.3
## Warning: package 'forcats' was built under R version 3.6.3
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()