September 2, 2020

Combining Multiple Tables

Today we will discuss the merging of multiple tables in R using dplyr.

The dataset we will look at is the nycflights13 dataset.

Tables:

flights
airlines
planes
airports

The grammar of data merging

The 5 verbs of data wrangling

inner_join() # take a subset of columns

left_join() # take a subset of rows

right_join() # add or modify existing columns

full_join() # sort the rows

bind_rows()

bind_cols()

RStudio Cheatsheet for data wrangling

The RStudio dplyr cheatsheet is very useful.

This is the same link as last time.

Try all of the joins on the cheatsheet to combine data sets.