How to merge data in R using R merge, dplyr, or data.table

How to merge data in R using R merge, dplyr, or data.table

R has a number of quick, elegant ways to join data frames by a common column. I’d like to show you three of them:

base R’s merge() function,
dplyr’s join family of functions, and
data.table’s bracket syntax.

Get and import the data

For this example I’ll use one of my favorite demo data sets — flight delay times from the U.S. Bureau of Transportation Statistics. If you want to follow along, head to http://bit.ly/USFlightDelays and download data for the time frame of your choice with the columns Flight Date, Reporting_Airline, Origin, Destination, and DepartureDelayMinutes. Also get the lookup table for Reporting_Airline.

To read this article in full, please click here