Summarizing Relationships, Tidying and Joining Data

Published

October 4, 2022

This content is from Fall 2022. Go to Fall 2023 site

Readings

  • For summarizing relationships, see QSS 3.6 and MD 5.1.1.
  • For pivoting and tidy data, see MD Ch 4.
  • For more on joins, see the chapter 20 in R for Data Science.

Data

  • Reinstall the Gov 50 data package that has new data for this week:
remotes::install_github("mattblackwell/gov50data")
  • If you cannot install the package, you can download the data locally at covid_votes.csv to the same directory as your Rmd file and load it using:
library(tidyverse)
covid_votes <- read_csv("covid_votes.csv")
  • For Thursday lecture, we added to additional data sets to gov50data. If you cannot install that package, then you can download them: mortality.csv and spotify.csv. Put them in the same folder as your Rmd file and use these commands to load:
library(tidyverse)
mortality <- read_csv("mortality.csv")
spotify <- read_csv("spotify.csv")
  • We will also use data from the nycflights13 package that you can install with:
install.packages("nycflights13")

Slides and Code